pub struct Model { /* private fields */ }
Expand description
Model builder.
Implementations§
Source§impl Model
impl Model
Sourcepub fn new<G: Into<GraphProto>>(graph: G) -> Self
pub fn new<G: Into<GraphProto>>(graph: G) -> Self
Creates a new builder.
Sourcepub fn model_version(self, model_version: i64) -> Self
pub fn model_version(self, model_version: i64) -> Self
Sets model doc_string.
Sourcepub fn producer_name<S: Into<String>>(self, producer_name: S) -> Self
pub fn producer_name<S: Into<String>>(self, producer_name: S) -> Self
Sets model doc_string.
Sourcepub fn producer_version<S: Into<String>>(self, producer_version: S) -> Self
pub fn producer_version<S: Into<String>>(self, producer_version: S) -> Self
Sets model doc_string.
Sourcepub fn doc_string<S: Into<String>>(self, doc_string: S) -> Self
pub fn doc_string<S: Into<String>>(self, doc_string: S) -> Self
Sets model doc_string.
Sourcepub fn metadata<K: Into<String>, V: Into<String>>(
self,
key: K,
value: V,
) -> Self
pub fn metadata<K: Into<String>, V: Into<String>>( self, key: K, value: V, ) -> Self
Inserts model metadata.
Sourcepub fn opset_import(self, opset: OperatorSetIdProto) -> Self
pub fn opset_import(self, opset: OperatorSetIdProto) -> Self
Inserts operator set import.
Sourcepub fn build(self) -> ModelProto
pub fn build(self) -> ModelProto
Builds the model.
Examples found in repository?
More examples
examples/add.rs (line 22)
4fn main() {
5 let mut graph = builder::Graph::new("add");
6
7 let x = graph
8 .input("X")
9 .typed(DataType::Float)
10 .dim(1)
11 .dim(10)
12 .node();
13 let y = graph
14 .input("Y")
15 .typed(DataType::Float)
16 .dim(1)
17 .dim(10)
18 .node();
19
20 let z = (x + y).with_name("Z");
21
22 let model = graph.outputs(z).model().build();
23
24 save_model("add.onnx", &model).unwrap();
25}
Trait Implementations§
Source§impl Into<ModelProto> for Model
impl Into<ModelProto> for Model
Source§fn into(self) -> ModelProto
fn into(self) -> ModelProto
Converts this type into the (usually inferred) input type.
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnwindSafe for Model
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