pytorch / pytorch/vision

Squeezenet model ONNX export

Open
#690 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

awaiting response
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

Hi,
I have some questions regarding the squeeznet model.

I failed at exporting the model to ONNX with the following error "ONNX export failed : Couldn't export operator aten:max_pool2d_with_indices".
I noticed that in /torch/onnx/symbolic.py , the use of "ceil_mode" is not supported in max_pool2d_with_indices.
After setting "ceil_mode" to False for all occurrences of "MaxPool2d", the export succeeds.

I also noticed that, when using the exported model mentioned above, the Pytorch results do not match the ONNX results, the reason being the use of "nn.Dropout(0.5)".

My questions are :

 1- Is there a particular reason "ceil_mode" is being used? and would there be a concern with setting it to False for the export to be possible? I could submit a PR with this change if no concern is noted.

 2- Why is "Dropout" used in the model outside of training? Could we remove it? 

Thanks

Contributor guide

Open the contributing guide

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

Start by reproducing the Squeezenet ONNX export failure and inspect /torch/onnx/symbolic.py, especially max_pool2d_with_indices and ceil_mode handling. Compare the exported model's results with PyTorch while accounting for the model's nn.Dropout(0.5). Done means the intended ceil_mode and Dropout behavior is decided and the export and output mismatch are addressed or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.