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
62
63
64
65
66
67
68
69
70
//! # onnx-extractor
//!
//! A minimal ONNX model loader for extracting weights, tensors, operations, and graph structure.
//!
//! This crate provides a simple interface to load ONNX models and extract:
//! - Tensor weights & raw data (zero-copy slices, owned buffers, external files)
//! - Tensor shapes, dimensions, and data types
//! - Operations and attributes (nodes, inputs/outputs, subgraphs)
//! - Graph topology and execution order
//!
//! ## Zero-Copy Design
//!
//! `Tensor::data()` returns a `TensorDataRef` which borrows tensor data without copying:
//! - Raw variant uses shared ownership (`Bytes`)
//! - Numeric variants borrow directly (`&[T]`)
//! - Strings variant borrows elements (`&[Bytes]`)
//!
//! `Tensor::into_data()` returns owned `TensorData` without copying:
//! - Raw variant returns shared ownership (`Bytes`)
//! - Numeric variants return owned vectors (`Vec<T>`)
//! - Strings variant returns owned vectors of shared elements (`Vec<Bytes>`)
//!
//! Endianness: Raw tensor data uses little-endian byte order as defined in the ONNX specification. Typed fields use native host representation.
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use onnx_extractor::Model;
//!
//! let model = Model::load_from_file("model.onnx")?;
//! println!("{}", model);
//!
//! // Access tensor shape and data
//! if let Some(tensor) = model.graph().tensors().get("weight_1") {
//! println!("Weight shape: {:?}", tensor.shape());
//! let data = tensor.data()?;
//! if let Some(bytes) = data.as_slice() {
//! println!("Data size: {} bytes", bytes.len());
//! }
//! }
//! # Ok::<(), onnx_extractor::Error>(())
//! ```
// include generated protobuf code inside a small module so we can silence
// lints and doc warnings originating from the generated file only.
pub
pub use *;
pub use AttributeValue;
pub use DataType;
pub use Error;
pub use Graph;
pub use Model;
pub use Operation;
pub use Bytes;
pub use ;