-
Notifications
You must be signed in to change notification settings - Fork 962
Pytorch to tensorflow inference results are different #595
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
Comments
Hi @EnisBerk , MMdnn' s IR format is NHWC, but pytorch only support NCHW. MMdnn adopts the method that transpose the input data from the beginning, which is obviously not completely correct. In your case, your model includes flatten operator and the successor op maxpool is expanded according to NCHW. However, the weight to be multiplied by maxpool is still in the format of NHWC in tensorflow, thus causing different results. And we can't use the method of transpose on both sides of the cnn-related op to solve the problem, because if transpose operations followed by reshape operations, it needs to change the tensor into a continuous type, which will also lead to inaccurate results. For your situation, you can manually add the permute operations to solve the problem like this:
|
Hi,
I am trying to convert tensorflow VGGish to pytorch.
You can see step by step what I am doing in that google colab notebook
Problems:
I am using google Colab:
Platform (like ubuntu 16.04/win10):
Ubuntu version: "17.10 (Artful Aardvark)"
Python version:
3.6.3
Source framework with version (like Tensorflow 1.4.1 with GPU):
Tensorflow 1.13.0-rc1 with GPU
Destination framework with version (like CNTK 2.3 with GPU):
Pytorch 1.0.1 with GPU
Pre-trained model path (webpath or webdisk path):
https://github.com/tensorflow/models/tree/master/research/audioset
https://storage.googleapis.com/audioset/vggish_model.ckpt
Running scripts:
colab research google
mirror on github
The text was updated successfully, but these errors were encountered: