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 {
                FixedConcatSlice::Const(c) => mats.push(c.view()),
                FixedConcatSlice::Var(shape) => {
                    let inp_view = casted_inputs[input_idx].to_array_view::<T>()?;
                    if inp_view.shape() != shape.as_slice() {
                        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 FixedConcat. 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 {
                FixedConcatSlice::Const(c) => mats.push(c.view()),
                FixedConcatSlice::Var(shape) => {
                    let inp_view = casted_inputs[input_idx].to_array_view::<T>()?;
                    if inp_view.shape() != shape.as_slice() {
                        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 FixedConcat. 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 { FixedConcatSlice :: Const ( c ) => mats . push ( c . view ( ) ) , FixedConcatSlice :: Var ( shape ) => { let inp_view = casted_inputs [ input_idx ] . to_array_view :: < T > ( ) ? ; if inp_view . shape ( ) != shape . as_slice ( ) { 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>>