onnx创建张量值

helper.make_tensor_value_info()是ONNX中的一个函数,用于创建一个张量值信息(Tensor Value Info)。

该函数的参数包括:

name:张量的名称。

type:张量的数据类型。

dims:张量的形状。

例如,以下代码创建了一个名为“input”的形状为(3,224,224)的浮点型张量值信息:
import onnx

from onnx import helper

# 创建一个形状为(3,224,224)的输入张量

x = helper.make_tensor_value_info('input', TensorProto.FLOAT, [1, 3, 224, 224])

猜你喜欢

转载自blog.csdn.net/qq_16792139/article/details/131431322
今日推荐