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