tract_pulse_opl/
slice.rs

1use tract_nnef::internal::*;
2
3#[derive(Debug, Clone, Default, Hash)]
4pub struct PulsedAxisSlice {
5    pub axis: usize,
6    pub skip: usize,
7    pub take: TDim,
8}
9
10
11
12impl Op for PulsedAxisSlice {
13    fn name(&self) -> Cow<str> {
14        "PulsedAxisSlice".into()
15    }
16
17    fn info(&self) -> TractResult<Vec<String>> {
18        Ok(vec![format!("axis:{}, skip:{} take:{}", self.axis, self.skip, self.take)])
19    }
20
21    not_a_typed_op!();
22}
23
24impl TypedOp for PulsedAxisSlice {
25    fn output_facts(&self, inputs: &[&TypedFact]) -> TractResult<TVec<TypedFact>> {
26        Ok(tvec!(inputs[0].clone()))
27    }
28
29    as_op!();
30}
31
32impl EvalOp for PulsedAxisSlice {
33    fn is_stateless(&self) -> bool {
34        false
35    }
36
37    fn eval(&self, inputs: TVec<TValue>) -> TractResult<TVec<TValue>> {
38        Ok(inputs)
39    }
40}