tract_pulse_opl/
lib.rs

1use tract_nnef::internal::*;
2
3pub mod concat;
4mod deconv_delay;
5mod delay;
6mod mask;
7mod pad;
8mod slice;
9
10pub use tract_nnef;
11pub use tract_nnef::tract_core;
12
13pub mod prelude {
14    pub use crate::WithPulse;
15    pub use tract_nnef::tract_core::internal::DimLike;
16}
17
18pub mod ops {
19    pub use super::deconv_delay::DeconvDelay;
20    pub use super::delay::{ Delay, DelayState };
21    pub use super::mask::PulseMask;
22    pub use super::pad::PulsePad;
23    pub use super::slice::PulsedAxisSlice;
24}
25
26pub trait WithPulse {
27    fn enable_pulse(&mut self);
28    fn with_pulse(self) -> Self;
29}
30
31impl WithPulse for tract_nnef::framework::Nnef {
32    fn enable_pulse(&mut self) {
33        self.enable_tract_core();
34        self.registries.push(tract_nnef_registry());
35    }
36    fn with_pulse(mut self) -> Self {
37        self.enable_pulse();
38        self
39    }
40}
41
42pub fn tract_nnef_registry() -> Registry {
43    let mut reg = Registry::new("tract_pulse")
44        .with_doc("Extension `tract_resource` extends NNEF with operators")
45        .with_doc("for pulsified networks.")
46        .with_doc("")
47        .with_doc("Add `extension tract_pulse` to `graph.nnef`");
48        
49    reg.aliases.push("pulse".into());
50    delay::register(&mut reg);
51    mask::register(&mut reg);
52    pad::register(&mut reg);
53    reg
54}