pub struct Model { /* private fields */ }Expand description
Main ONNX model container
Implementations§
Source§impl Model
impl Model
Sourcepub fn load_from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn load_from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Load ONNX model from a file path using memory mapping (mmap).
The parent directory of path is used to resolve external data files.
Sourcepub fn load_from_bytes(data: impl Into<Bytes>) -> Result<Self, Error>
pub fn load_from_bytes(data: impl Into<Bytes>) -> Result<Self, Error>
Load ONNX model from byte buffer (e.g., Vec<u8>, Bytes, &'static [u8]).
Use Model::load_from_bytes_with_path if the model references external data files.
Sourcepub fn load_from_bytes_with_path<P: AsRef<Path>>(
data: impl Into<Bytes>,
path: P,
) -> Result<Self, Error>
pub fn load_from_bytes_with_path<P: AsRef<Path>>( data: impl Into<Bytes>, path: P, ) -> Result<Self, Error>
Load ONNX model from byte buffer (e.g., Vec<u8>, Bytes, &'static [u8])
with a directory path for resolving external data files.
Note: path must be the folder/directory containing the external data files, not a file path.
Use Model::load_from_bytes if the model contains no external data files.
Sourcepub fn into_graph(self) -> Graph
pub fn into_graph(self) -> Graph
Consume the model and return the root graph
Sourcepub fn ir_version(&self) -> i64
pub fn ir_version(&self) -> i64
Get IR version
Sourcepub fn producer_name(&self) -> Option<&str>
pub fn producer_name(&self) -> Option<&str>
Get producer name
Sourcepub fn producer_version(&self) -> Option<&str>
pub fn producer_version(&self) -> Option<&str>
Get producer version
Sourcepub fn model_version(&self) -> Option<i64>
pub fn model_version(&self) -> Option<i64>
Get model version
Sourcepub fn doc_string(&self) -> Option<&str>
pub fn doc_string(&self) -> Option<&str>
Get documentation string
Sourcepub fn default_opset_version(&self) -> Option<i64>
pub fn default_opset_version(&self) -> Option<i64>
Get the imported opset version for the default ONNX domain (“”)