【bug记录】pytorch转onnx报错:[ CUDALongType{1} ]) of traced region did not have observable data dependence

报错内容:

[ CUDALongType{1} ]) of traced region did not have observable data dependence with trace inputs; this probably indicates your program cannot be understood by the tracer

问题:
在onnx转换,模型输出必须是张量,而不是列表,元组,或字典。检查一下模型forward函数return的是不是张量

解决方法:
我这边模型forward函数return的是tuple,so:

return output --> return output[0]

你可能感兴趣的:(bug记录,pytorch,bug,人工智能,onnx)