1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use crate::internal::*; use tract_core::ops::element_wise::ElementWiseOp; register_all!(ElementWiseOp: pulsify); fn pulsify( op: &ElementWiseOp, _source: &TypedModel, node: &TypedNode, target: &mut PulsedModel, mapping: &HashMap<OutletId, OutletId>, _pulse: usize, ) -> TractResult<TVec<OutletId>> { let input = mapping[&node.inputs[0]]; target.wire_node(&*node.name, op.clone(), &[input]) } impl PulsedOp for ElementWiseOp { fn pulsed_output_facts(&self, inputs: &[&PulsedFact]) -> TractResult<TVec<PulsedFact>> { let mut fact = inputs[0].clone(); if let Some(dt) = self.0.output_type(fact.datum_type) { fact.datum_type = dt; } Ok(tvec!(fact)) } as_op!(); pulsed_op_to_typed_op!(); }