pub struct OnnxLoader;Expand description
ONNX model loader.
Implementations§
Source§impl OnnxLoader
impl OnnxLoader
Sourcepub fn load_onnx(path: &str) -> Result<Model, String>
pub fn load_onnx(path: &str) -> Result<Model, String>
Load an ONNX model from a binary file. This implements a minimal subset of the protobuf format — enough for simple models.
The format we support is our own simplified binary:
- magic: b“ONNX“ (4 bytes)
- num_nodes: u32 LE
- For each node:
- op_type: u8 (0=Gemm,1=Conv,2=Relu,3=MaxPool,4=BatchNorm,5=Reshape,6=Softmax,7=Add,8=Mul)
- num_weights: u32 LE
- For each weight tensor: [ndim: u32] [shape…] [data as f32 LE]
Auto Trait Implementations§
impl Freeze for OnnxLoader
impl RefUnwindSafe for OnnxLoader
impl Send for OnnxLoader
impl Sync for OnnxLoader
impl Unpin for OnnxLoader
impl UnsafeUnpin for OnnxLoader
impl UnwindSafe for OnnxLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.