Serialization ONNX序列化以字符串作为输入的火炬模型
有没有把字符串作为输入的ONNX序列化torch模型的例子 在Serialization ONNX序列化以字符串作为输入的火炬模型,serialization,torch,onnx,Serialization,Torch,Onnx,有没有把字符串作为输入的ONNX序列化torch模型的例子 在torch.onnx.export函数中将随机类型设置为args,将生成: RuntimeError: Only tuples, lists and Variables supported as JIT inputs/outputs. Dictionaries and strings are also accepted but their usage is not recommended. But got unsupported ty
torch.onnx.export
函数中将随机类型设置为args
,将生成:
RuntimeError: Only tuples, lists and Variables supported as JIT inputs/outputs. Dictionaries and strings are also accepted but their usage is not recommended. But got unsupported type numpy.ndarray
但是在args
定义下也有这样的解释:
... Any non-Tensor arguments will
be hard-coded into the exported model; any Tensor arguments
will become inputs of the exported model, in the order they
occur in args. If args is a Tensor, this is equivalent
有没有一种方法可以像这样序列化模型:
model('hello world')
输出:[0.8,0.2]