make_tensor_value_info("input2", TensorProto.FLOAT, shape=(1, 5))] outputs = [helper.make_tensor_value_info("output", TensorProto.FLOAT, shape=(1, 3, 4, 5))] nodes = [helper.make_node("Add", ["input1", "input2"], ["output"])] graph = helper.make_graph(nodes, "bcast_...
make_tensor_value_info( name, np2onnx_dtype(array.dtype), array.shape) for name, array in zip(node.input, inputs)] graph_outputs = [onnx_helper.make_tensor_value_info( name, np2onnx_dtype(output_dtype), output_shape) for name in node.output] if use_weights: # Add initializers ...
onnx.helper---tensor、tensor value info、attribute make_tensor [类型:TensorProto] make_tensor(name,data_type,dims,vals,raw=False) name:数据名字,要与该数据的信息tensor value info中名字对应 [类型:字符串] data_type:数据类型 [类型:TensorProto.DataType] 如TensorProto.FLOAT、TensorProto.UINT8、Ten...
conv_output = helper.make_tensor_value_info('conv_output',TensorProto.FLOAT,[1,32,512,512]) add_input = helper.make_tensor_value_info('add_input',TensorProto.FLOAT,[1]) output = helper.make_tensor_value_info('output',TensorProto.FLOAT,[1,32,512,512]) ...
I am trying to replace a node of a onnx model. but I need calculate the node value: sizes = np.concatenate([part_a, part_b]) # replace resizes input with sizes # new_node = helper.make_tensor_value_info(in_sizes, TensorProto.INT64, sizes...
graph=onnx_model.graph#创建新节点#new_output = helper.make_tensor_value_info(new_output_name,#model.graph.output[len(model.graph.output) - 1].type.tensor_type.elem_type,#model.graph.output[len(model.graph.output) - 1].type.tensor_type.shape)modify_input_node=False ...
ValueInfoProto TensorProto 他们之间的关系:ONNX 模型load之后,得到的是一个ModelProto,它包含了一些版本信息,生产者信息和一个非常重要的GraphProto;在GraphProto中包含了四个关键的repeated数组,分别是node(NodeProto 类型),input(ValueInfoProto 类型),output(ValueInfoProto 类型)和initializer(TensorProto 类型),其...
如下构建一个简单的onnx模型,其中helper。make_node的node name需要按照onnx包含的常见算子定义,否则onnx.checker.check_model不能通过。 import onnx from onnx import helper,AttributeProto, TensorProto, GraphProto X=helper.make_tensor_value_info('X',TensorProto.FLOAT,[1,3,32,32]) #n,ci,h,w ...
[helper.make_tensor_value_info("Z", TensorProto.FLOAT, (2, 3, 4))], ) original_model = helper.make_model(graph, producer_name="onnx-examples") # 检查模型并打印Y的信息 onnx.checker.check_model(original_model) print(f"Before shape inference, the shape info of Y is:\n{original_mode...
首先,我们可以用helper.make_tensor_value_info构造出一个描述张量信息的ValueInfoProto对象。如前面的类图所示,我们要传入张量名、张量的基本数据类型、张量形状这三个信息。在 ONNX 中,不管是输入张量还是输出张量,它们的表示方式都是一样的。因此,这里我们用类似的方式为三个输入a, x, b和一个输出output构造Valu...