pytorch转onnx时的报错:
Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs
解决方案:
- 这是因为将pytorch变量转程python引起的,如何你这个变量没有用于梯度传到过程中,就可以忽略。
- 如果用于梯度误差传播,应该可以用pytorch声明成变量。具体没有尝试过。
最后
以上就是风中项链最近收集整理的关于pytorch报错Converting a tensor to a Python integer的全部内容,更多相关pytorch报错Converting内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复