pub fn replace_single_op<O: Into<Box<Op>>>(
        patched_model: &Model<TI>,
        node: &Node<TI>,
        inputs: &[OutletId],
        new_op: O,
    ) -> TractResult<ModelPatch<TI>> {
        let mut patch = ModelPatch::default();
        let new_op = new_op.into();
        let outputs = node.outputs.iter().map(|o| objekt::clone(&o.fact)).collect();
        let by = patch.add_node(&*node.name, new_op, outputs)?;
        for (ix, i) in inputs.iter().enumerate() {
            let o = patch.tap_model(&patched_model, *i)?;
            patch.add_edge(o, InletId::new(by, ix))?;
        }
        for ix in 0..node.outputs.len() {
            patch.shunt_outside(OutletId::new(node.id, ix), OutletId::new(by, ix))?;
        }
        Ok(patch)
    }
/// Convenience method creating a patch that replace a single operation.
Convenience method creating a patch that replace a single operation.
Convenience method creating a patch that replace a single operation .
pub fn replace_single_op<O: Into<Box<Op>>>(
        patched_model: &Model<TI>,
        node: &Node<TI>,
        inputs: &[OutletId],
        new_op: O,
    ) -> TractResult<ModelPatch<TI>> {
        let mut patch = ModelPatch::default();
        let new_op = new_op.into();
        let outputs = node.outputs.iter().map(|o| objekt::clone(&o.fact)).collect();
        let by = patch.add_node(&*node.name, new_op, outputs)?;
        for (ix, i) in inputs.iter().enumerate() {
            let o = patch.tap_model(&patched_model, *i)?;
            patch.add_edge(o, InletId::new(by, ix))?;
        }
        for ix in 0..node.outputs.len() {
            patch.shunt_outside(OutletId::new(node.id, ix), OutletId::new(by, ix))?;
        }
        Ok(patch)
    }
pub fn replace_single_op < O : Into < Box < Op > > > ( patched_model : & Model < TI > , node : & Node < TI > , inputs : & [ OutletId ] , new_op : O , ) -> TractResult < ModelPatch < TI > > { let mut patch = ModelPatch :: default ( ) ; let new_op = new_op . into ( ) ; let outputs = node . outputs . iter ( ) . map ( | o | objekt :: clone ( & o . fact ) ) . collect ( ) ; let by = patch . add_node ( & * node . name , new_op , outputs ) ? ; for ( ix , i ) in inputs . iter ( ) . enumerate ( ) { let o = patch . tap_model ( & patched_model , * i ) ? ; patch . add_edge ( o , InletId :: new ( by , ix ) ) ? ; } for ix in 0 .. node . outputs . len ( ) { patch . shunt_outside ( OutletId :: new ( node . id , ix ) , OutletId :: new ( by , ix ) ) ? ; } Ok ( patch ) }
Convenience method creating a patch that replace a single operation.
Convenience method creating a patch that replace a single operation .
patched_model
&Model<TI>
node
&Node<TI>
inputs
&[OutletId]
new_op
O
patched_model
&Model<TI>
node
&Node<TI>
inputs
&[OutletId]
new_op
O