Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ONNX loader doesn't load the BatchNorm parameters epsilon and momentum? #305

Closed
lauracanalini opened this issue Nov 26, 2021 · 4 comments
Closed

Comments

@lauracanalini
Copy link
Contributor

lauracanalini commented Nov 26, 2021

To Reproduce
Steps to reproduce the behavior:

  1. Load ResNet ONNX here https://drive.google.com/file/d/1gqLI0k4NEQL6dsZFx-iI2zFZBBgucUTd/view?usp=sharing
  2. Check values in layers[2]
  3. Open ONNX in netron.app
  4. Compare values

Expected behavior
They should be the same.

@chavicoski
Copy link
Contributor

They are almost the same, there is a certain loss of precision.

Reproducing the issue:
Netron: momentum = 0.009999999776482582 - EDDL momentum = 0.01
Netron: epsilon = 0.10000000149011612 - EDDL epsilon = 0.1

And they must be loaded because the default values in ONNX are momentum=0.9 and epsilon=1e-5.

float epsilon = 1e-05f; // Default value according to ONNX standard

@lauracanalini
Copy link
Contributor Author

Right, I was loading the ONNX incorrectly.
But now I have another question: if as reported issue #302, eddl uses 1 - momentum compared to PyTorch, when it loads a PyTorch ONNX shouldn't it load 1 - onnx momentum?

@chavicoski
Copy link
Contributor

Yes, you are right. I am going to change it.

@chavicoski
Copy link
Contributor

I checked the ONNX operators definition and it is correct now, I don't have to change it.

You can see here that the ONNX definiton uses the momentum like the EDDL. This means that if you use a momentum of 0.1 in Pytorch, It should export it as momenum=0.9. But the EDDL is importing it right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants