pytorch转onnx问题

时间:2019-09-18 18:20:00   收藏:0   阅读:1073

 

1. RuntimeError: ONNX export failed: Couldn‘t export operator aten::rsqrt

技术分享图片

 2. RuntimeError: ONNX export failed: Couldn‘t export operator aten::reshape

原因:pytorch-1.0.1不支持reshape操作

解决:~/anaconda3/envs/py36/lib/python3.6/site-packages/torch/onnx/symbolic.py

在该文件中添加代码

def reshape(g, self, shape):
    return view(g, self, shape)


def reshape_as(g, self, other):
    shape = g.op(Shape, other)
    return reshape(g, self, shape)

 

原文:https://www.cnblogs.com/haiyang21/p/11543951.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!