fn eval(&self, inputs: TVec<Arc<Tensor>>) -> TractResult<TVec<Arc<Tensor>>> {
        let casted_inputs: TVec<Cow<Tensor>> =
            inputs.iter().map(|x| x.cast_to::<T>()).collect::<TractResult<_>>()?;
        let mut mats: TVec<ArrayViewD<T>> = tvec![];
        let mut input_idx = 0;
        for slice in &self.slices {
            match slice {
                NormConcatSlice::Const(c) => mats.push(c.view()),
                NormConcatSlice::Var(shape) => {
                    let inp_view = casted_inputs[input_idx].to_array_view::<T>()?;
                    for (i_dim, e_dim) in inp_view.shape().iter().zip(shape.iter()) {
                        if let Ok(e_dim) = e_dim.to_integer() {
                            if e_dim != *i_dim as i32 {
                                bail!(
                                    "Unexpected input shape. Expected {:?}, found {:?}",
                                    shape,
                                    inp_view.shape()
                                );
                            }
                        }
                    }
                    mats.push(inp_view);
                    input_idx += 1
                }
            }
        }
        if input_idx != inputs.len() {
            bail!(
                "Unexpected number of variable inputs to NormConcat. Expected {}, got {}",
                input_idx,
                inputs.len()
            );
        }

        let result = ::ndarray::stack(Axis(self.axis), &mats)?;
        Ok(tvec![result.into_arc_tensor()])
    }
/// Evaluates the operation given the input tensors.
Evaluates the operation given the input tensors.
Evaluates the operation given the input tensors .
fn eval(&self, inputs: TVec<Arc<Tensor>>) -> TractResult<TVec<Arc<Tensor>>> {
        let casted_inputs: TVec<Cow<Tensor>> =
            inputs.iter().map(|x| x.cast_to::<T>()).collect::<TractResult<_>>()?;
        let mut mats: TVec<ArrayViewD<T>> = tvec![];
        let mut input_idx = 0;
        for slice in &self.slices {
            match slice {
                NormConcatSlice::Const(c) => mats.push(c.view()),
                NormConcatSlice::Var(shape) => {
                    let inp_view = casted_inputs[input_idx].to_array_view::<T>()?;
                    for (i_dim, e_dim) in inp_view.shape().iter().zip(shape.iter()) {
                        if let Ok(e_dim) = e_dim.to_integer() {
                            if e_dim != *i_dim as i32 {
                                bail!(
                                    "Unexpected input shape. Expected {:?}, found {:?}",
                                    shape,
                                    inp_view.shape()
                                );
                            }
                        }
                    }
                    mats.push(inp_view);
                    input_idx += 1
                }
            }
        }
        if input_idx != inputs.len() {
            bail!(
                "Unexpected number of variable inputs to NormConcat. Expected {}, got {}",
                input_idx,
                inputs.len()
            );
        }
        let result = ::ndarray::stack(Axis(self.axis), &mats)?;
        Ok(tvec![result.into_arc_tensor()])
    }
fn eval ( & self , inputs : TVec < Arc < Tensor > > ) -> TractResult < TVec < Arc < Tensor > > > { let casted_inputs : TVec < Cow < Tensor > > = inputs . iter ( ) . map ( | x | x . cast_to :: < T > ( ) ) . collect :: < TractResult < _ > > ( ) ? ; let mut mats : TVec < ArrayViewD < T > > = tvec ! [ ] ; let mut input_idx = 0 ; for slice in & self . slices { match slice { NormConcatSlice :: Const ( c ) => mats . push ( c . view ( ) ) , NormConcatSlice :: Var ( shape ) => { let inp_view = casted_inputs [ input_idx ] . to_array_view :: < T > ( ) ? ; for ( i_dim , e_dim ) in inp_view . shape ( ) . iter ( ) . zip ( shape . iter ( ) ) { if let Ok ( e_dim ) = e_dim . to_integer ( ) { if e_dim != * i_dim as i32 { bail ! ( " " shape inp_view shape ( ) ) ; } } } mats . push ( inp_view ) ; input_idx += 1 } } } if input_idx != inputs . len ( ) { bail ! ( " " input_idx inputs len ( ) ) ; } let result = :: ndarray :: stack ( Axis ( self . axis ) , & mats ) ? ; Ok ( tvec ! [ result into_arc_tensor ( ) ] ) }
Evaluates the operation given the input tensors.
Evaluates the operation given the input tensors .
&self
inputs
TVec<Arc<Tensor>>
&self
inputs
TVec<Arc<Tensor>>