pub fn run(
        &mut self,
        inputs: Vec<(&str, Tensor)>,
        output_name: &str,
    ) -> TractResult<Vec<Tensor>> {
        let tensors: Vec<(&str, TensorHolder)> =
            inputs.into_iter().map(|(name, mat)| (name, mat.into())).collect();

        let mut step = SessionRunArgs::new();
        for t in &tensors {
            let op = self.graph.operation_by_name_required(t.0)?;
            match t.1 {
                TensorHolder::Bool(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::U8(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::U16(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::I8(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::I16(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::I32(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::I64(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::F16(_) => unimplemented!(),
                TensorHolder::F32(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::F64(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::String(ref it) => step.add_feed(&op, 0, &it),
            }
        }

        let op = &self.graph.operation_by_name_required(output_name)?;
        let tokens =
            (0..op.num_outputs()).map(|ix| step.request_fetch(&op, ix as i32)).collect::<Vec<_>>();

        let mut session = Session::new(&::tensorflow::SessionOptions::new(), &self.graph)?;
        session.run(&mut step)?;

        tokens
            .into_iter()
            .enumerate()
            .map(|(ix, tok)| {
                let output_type =
                    &self.graph.operation_by_name_required(&output_name)?.output_type(ix);
                convert_output(&mut step, output_type, tok)
            })
            .collect()
    }
/// Executes the graph in one batch.
Executes the graph in one batch.
Executes the graph in one batch .
pub fn run(
        &mut self,
        inputs: Vec<(&str, Tensor)>,
        output_name: &str,
    ) -> TractResult<Vec<Tensor>> {
        let tensors: Vec<(&str, TensorHolder)> =
            inputs.into_iter().map(|(name, mat)| (name, mat.into())).collect();
        let mut step = SessionRunArgs::new();
        for t in &tensors {
            let op = self.graph.operation_by_name_required(t.0)?;
            match t.1 {
                TensorHolder::Bool(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::U8(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::U16(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::I8(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::I16(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::I32(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::I64(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::F16(_) => unimplemented!(),
                TensorHolder::F32(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::F64(ref it) => step.add_feed(&op, 0, &it),
                TensorHolder::String(ref it) => step.add_feed(&op, 0, &it),
            }
        }
        let op = &self.graph.operation_by_name_required(output_name)?;
        let tokens =
            (0..op.num_outputs()).map(|ix| step.request_fetch(&op, ix as i32)).collect::<Vec<_>>();
        let mut session = Session::new(&::tensorflow::SessionOptions::new(), &self.graph)?;
        session.run(&mut step)?;
        tokens
            .into_iter()
            .enumerate()
            .map(|(ix, tok)| {
                let output_type =
                    &self.graph.operation_by_name_required(&output_name)?.output_type(ix);
                convert_output(&mut step, output_type, tok)
            })
            .collect()
    }
pub fn run ( & mut self , inputs : Vec < ( & str , Tensor ) > , output_name : & str , ) -> TractResult < Vec < Tensor > > { let tensors : Vec < ( & str , TensorHolder ) > = inputs . into_iter ( ) . map ( | ( name , mat ) | ( name , mat . into ( ) ) ) . collect ( ) ; let mut step = SessionRunArgs :: new ( ) ; for t in & tensors { let op = self . graph . operation_by_name_required ( t . 0 ) ? ; match t . 1 { TensorHolder :: Bool ( ref it ) => step . add_feed ( & op , 0 , & it ) , TensorHolder :: U8 ( ref it ) => step . add_feed ( & op , 0 , & it ) , TensorHolder :: U16 ( ref it ) => step . add_feed ( & op , 0 , & it ) , TensorHolder :: I8 ( ref it ) => step . add_feed ( & op , 0 , & it ) , TensorHolder :: I16 ( ref it ) => step . add_feed ( & op , 0 , & it ) , TensorHolder :: I32 ( ref it ) => step . add_feed ( & op , 0 , & it ) , TensorHolder :: I64 ( ref it ) => step . add_feed ( & op , 0 , & it ) , TensorHolder :: F16 ( _ ) => unimplemented ! ( ) , TensorHolder :: F32 ( ref it ) => step . add_feed ( & op , 0 , & it ) , TensorHolder :: F64 ( ref it ) => step . add_feed ( & op , 0 , & it ) , TensorHolder :: String ( ref it ) => step . add_feed ( & op , 0 , & it ) , } } let op = & self . graph . operation_by_name_required ( output_name ) ? ; let tokens = ( 0 .. op . num_outputs ( ) ) . map ( | ix | step . request_fetch ( & op , ix as i32 ) ) . collect :: < Vec < _ > > ( ) ; let mut session = Session :: new ( & :: tensorflow :: SessionOptions :: new ( ) , & self . graph ) ? ; session . run ( & mut step ) ? ; tokens . into_iter ( ) . enumerate ( ) . map ( | ( ix , tok ) | { let output_type = & self . graph . operation_by_name_required ( & output_name ) ? . output_type ( ix ) ; convert_output ( & mut step , output_type , tok ) } ) . collect ( ) }
Executes the graph in one batch.
Executes the graph in one batch .
&mut self
inputs
Vec<(&str, Tensor)>
output_name
&str
&mut self
inputs
Vec<(&str, Tensor)>
output_name
&str