onnx_helpers/nodes/ops/constant.rs
1//! Constant operation.
2
3use onnx_pb::TensorProto;
4
5use crate::{builder, node_to_inner, nodes::Node};
6
7/// Constant node.
8pub struct Constant {
9 inner: Node,
10}
11
12impl Constant {
13 /// Creates new Constant operation.
14 #[inline(always)]
15 pub fn new<N: Into<String>, T: Into<TensorProto>>(name: N, value: T) -> Self {
16 Constant {
17 inner: builder::Node::new("Constant")
18 .name(name)
19 .attribute("value", value.into())
20 .build(),
21 }
22 }
23}
24
25node_to_inner!(Constant);