Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Serialization ONNX序列化以字符串作为输入的火炬模型_Serialization_Torch_Onnx - Fatal编程技术网

Serialization ONNX序列化以字符串作为输入的火炬模型

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

有没有把字符串作为输入的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 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]