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

Fix for keras applications preprocess_input with data_format="channels_first" symbolic tensors #47135

Conversation

PaulKlinger
Copy link
Contributor

Fixes #46539

The rescaling by std in keras.applications.imagenet_utils._preprocess_symbolic_input was not taking into account data_format, causing a shape mismatch error.

This was not caught by the unit tests as only the default mode='caffe' was tested, which does not use std. I changed the test to run for all modes.

… tensors

The scaling by std deviation was not taking into account the channel order
and caused an error when a symbolic tensor was provided with mode='torch'
(e.g. for tf.keras.applications.densenet.preprocess_input).
This commit corrects that, and runs the tests for all modes instead of
just the default.
@google-ml-butler google-ml-butler bot added the size:S CL Change Size: Small label Feb 13, 2021
@google-cla google-cla bot added the cla: yes label Feb 13, 2021
@gbaned gbaned self-assigned this Feb 15, 2021
@gbaned gbaned added comp:keras Keras related issues prtype:bugfix PR to fix a bug labels Feb 15, 2021
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Feb 15, 2021
@gbaned gbaned self-requested a review February 15, 2021 04:45
@gbaned gbaned added the awaiting review Pull request awaiting review label Feb 17, 2021
Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

PR Queue automation moved this from Assigned Reviewer to Approved by Reviewer Feb 18, 2021
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Feb 18, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Feb 18, 2021
@gbaned gbaned added ready to pull PR ready for merge process and removed awaiting review Pull request awaiting review ready to pull PR ready for merge process labels Feb 19, 2021
@copybara-service copybara-service bot merged commit f669266 into tensorflow:master Feb 23, 2021
PR Queue automation moved this from Approved by Reviewer to Merged Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:keras Keras related issues prtype:bugfix PR to fix a bug ready to pull PR ready for merge process size:S CL Change Size: Small
Projects
PR Queue
  
Merged
4 participants