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

报错内容:

[ 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]

猜你喜欢

转载自blog.csdn.net/Roaddd/article/details/128293394
今日推荐