microsoft / MMdnn

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
MIT License
5.79k stars 964 forks source link

Inferred shape and existing shape differ error #646

Open vijay73anand opened 5 years ago

vijay73anand commented 5 years ago

All I did was converted a standard vgg16 prototxt and standard vgg caffemodel from caffe and then converted it to onnx using mmdnn and then tried to convert it to caffe2, but got following error while converting generated onnx model to caffe2.

File "/usr/local/lib/python3.5/dist-packages/onnx-1.2.3-py3.5-linux-x86_64.egg/onnx/backend/base.py", line 75, in run_model backend = cls.prepare(model, device, **kwargs) File "/usr/local/lib/python3.5/dist-packages/caffe2/python/onnx/backend.py", line 713, in prepare model = onnx.shape_inference.infer_shapes(model) File "/usr/local/lib/python3.5/dist-packages/onnx-1.2.3-py3.5-linux-x86_64.egg/onnx/shape_inference.py", line 36, in infer_shapes inferred_model_str = C.infer_shapes(model_str) RuntimeError: Inferred shape and existing shape differ in rank: (2) vs (3)

JiahaoYao commented 5 years ago

Hi @vijay73anand, thank you for reporting but please make sure whether it is an issue related to caffe2. You can check whether the IR of MMdnn is correct by converting to other frameworks that MMdnn supports.