onnx / onnx/models

Certain models may be missing a reshape op

Open
#444 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Jupyter Notebook
Stars
9.8k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Bug Report

Which model does this pertain to?

-models/vision/classification/rcnn_ilsvrc13/model/rcnn-ilsvrc13-3.onnx
-models/vision/classification/alexnet/model/bvlcalexnet-3.onnx
-models/vision/classification/resnet/model/resnet50-caffe2-v1-3.onnx
-models/vision/classification/zfnet-512/model/zfnet512-3.onnx
-models/vision/classification/inception_and_googlenet/inception_v1/model/inception-v1-3.onnx
-models/vision/classification/inception_and_googlenet/inception_v2/model/inception-v2-3.onnx
-models/vision/classification/vgg/model/vgg19-caffe2-3.onnx
-models/vision/classification/caffenet/model/caffenet-6.onnx
-models/vision/classification/shufflenet/model/shufflenet-3.onnx

Describe the bug

We observed an error that seems to be common between all of the above models when running them using MIGraphX. It appears that they may be missing a reshape operator between a MaxPooling layer and a Gemm layer, which causes an error when the Gemm op has inputs A and B with different dimensionalities.

E.g. caffenet-6.onnx vs caffenet-3.onnx are identical except that caffenet-3 has a reshape between the MaxPooling and the Gemm, which makes the shapes of the Gemm's inputs A:{1, 9216} and B:{4096, 9216}(transB=True) - this model runs without error. Whereas caffenet-6 is missing this reshape, which makes the shapes of the Gemm's inputs A:{1, 256, 6, 6} and B:{4096, 9016}(transB=True), which causes a mismatch error.

Reproduction instructions

System Information

Linux Ubuntu 18.04
ONNX version 1.8
Run directly from MIGraphX Driver

(Build and install MIGraphX within our Docker container):

/code/AMDMIGraphX/AMDMIGraphX/build/bin/driver read /path/to/caffenet-6.onnx

The difference between model versions can also be observed by viewing the graphs in Netron.

Running the models in ONNX Runtime on my system encountered other issues before reaching the operators that are producing this error.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the listed ONNX model files and compare the caffenet-6.onnx and caffenet-3.onnx graphs in Netron, focusing on the MaxPooling-to-Gemm path. Use the MIGraphX driver command from the report to reproduce the dimensionality error. Done means the affected models load without the reported Gemm shape mismatch.

Written by the indexing model from the issue text.

Assessment

Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.