add/
add.rs

1use onnx_helpers::prelude::*;
2use onnx_pb::{save_model, tensor_proto::DataType};
3
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}