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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
#[allow(unused_imports)] #[macro_use] extern crate derive_new; #[macro_use] extern crate educe; #[allow(unused_imports)] #[macro_use] extern crate log; extern crate num_integer; #[allow(unused_imports)] #[macro_use] pub extern crate tract_hir; pub mod model; pub mod ops; pub mod pb { include!(concat!(env!("OUT_DIR"), "/prost/onnx.rs")); } pub mod pb_helpers; pub mod tensor; pub use model::Onnx; pub use tract_hir::tract_core; pub mod prelude { pub use crate::onnx; pub use crate::WithOnnx; pub use tract_hir::prelude::*; } use tract_hir::prelude::*; #[deprecated(note = "Please use onnx().model_for_path(..)")] pub fn for_path(p: impl AsRef<std::path::Path>) -> TractResult<InferenceModel> { onnx().model_for_path(p) } #[deprecated(note = "Please use onnx().model_for_read(..)")] pub fn for_reader<R: std::io::Read>(mut r: R) -> TractResult<InferenceModel> { onnx().model_for_read(&mut r) } pub fn onnx() -> Onnx { let mut ops = crate::model::OnnxOpRegister::default(); ops::register_all_ops(&mut ops); Onnx { op_register: ops } } pub trait WithOnnx { fn with_onnx(self) -> Self; } impl WithOnnx for tract_nnef::framework::Nnef { fn with_onnx(mut self) -> Self { self = self.with_tract_core(); self.registries.push(ops::nnef::tract_nnef_onnx_registry()); self } }