axonml_onnx/lib.rs
1//! Axonml ONNX - ONNX Import/Export for ML Models
2//!
3//! This crate provides support for importing and exporting models in the
4//! ONNX (Open Neural Network Exchange) format, enabling interoperability
5//! with PyTorch, TensorFlow, and other ML frameworks.
6//!
7//! # Features
8//! - Import ONNX models and convert to Axonml modules
9//! - Export Axonml models to ONNX format
10//! - Support for common operators (Conv, MatMul, ReLU, etc.)
11//! - Weight loading from ONNX initializers
12//!
13//! # Example
14//! ```ignore
15//! use axonml_onnx::{OnnxModel, import_onnx};
16//!
17//! // Import an ONNX model
18//! let model = import_onnx("model.onnx")?;
19//!
20//! // Run inference
21//! let output = model.forward(&input);
22//!
23//! // Export back to ONNX
24//! model.export_onnx("model_out.onnx")?;
25//! ```
26//!
27//! @version 0.1.0
28//! @author AutomataNexus Development Team
29
30#![warn(missing_docs)]
31#![warn(clippy::all)]
32#![allow(clippy::module_name_repetitions)]
33#![allow(clippy::must_use_candidate)]
34#![allow(clippy::missing_errors_doc)]
35#![allow(clippy::missing_panics_doc)]
36
37pub mod error;
38pub mod model;
39pub mod operators;
40pub mod parser;
41pub mod proto;
42pub mod export;
43
44pub use error::{OnnxError, OnnxResult};
45pub use model::OnnxModel;
46pub use parser::{import_onnx, import_onnx_bytes};
47pub use export::export_onnx;
48
49// =============================================================================
50// Re-exports for convenience
51// =============================================================================
52
53/// ONNX opset version supported by this crate.
54pub const SUPPORTED_OPSET_VERSION: i64 = 17;
55
56/// ONNX IR version.
57pub const ONNX_IR_VERSION: i64 = 8;
58
59// =============================================================================
60// Tests
61// =============================================================================
62
63#[cfg(test)]
64mod tests {
65 use super::*;
66
67 #[test]
68 fn test_constants() {
69 assert!(SUPPORTED_OPSET_VERSION > 0);
70 assert!(ONNX_IR_VERSION > 0);
71 }
72}