You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.
Probably related to issue #8. Running the code in the notebook example.ipynb showed differences between the keras and pytorch model.
The issue is that the Keras Flatten function does a permutation (see https://github.com/keras-team/keras/blob/master/keras/layers/core.py#L507) of the input data when the data_format is set to 'channel_first' which unnecessary since the data is provided in channel_first format. Essentially, Flatten permutes the data into the incorrect format which leads to the observed differences.
The fix is to specify the data format to prevent the permutation:
model.add(Flatten(data_format='channels_last'))
This creates an instance of Flatten that will not permute the data. See attached file. example.ipynb.zip
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Probably related to issue #8. Running the code in the notebook example.ipynb showed differences between the keras and pytorch model.
The issue is that the Keras Flatten function does a permutation (see https://github.com/keras-team/keras/blob/master/keras/layers/core.py#L507) of the input data when the data_format is set to 'channel_first' which unnecessary since the data is provided in channel_first format. Essentially, Flatten permutes the data into the incorrect format which leads to the observed differences.
The fix is to specify the data format to prevent the permutation:
model.add(Flatten(data_format='channels_last'))
This creates an instance of Flatten that will not permute the data. See attached file.
example.ipynb.zip
The text was updated successfully, but these errors were encountered: