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 bug in tf.keras.metrics.sparse_categorical_accuracy #22392

Merged
merged 2 commits into from
Oct 4, 2018

Conversation

yanboliang
Copy link
Contributor

Fix #22190

For the input of tf.keras.metrics.sparse_categorical_accuracy, the shape of y_true can be (num_samples, 1) or (num_samples,), see #22190 for detail. The existing code assume the shape of y_true is (num_samples, 1), always reduce in the last dimension which leads the incorrect output. Actually we should check the shape of y_true and squeeze if applicable.
Meanwhile, I also fix sparse_top_k_categorical_accuracy which has the same issue.

@qlzh727 qlzh727 added the kokoro:force-run Tests on submitted change label Sep 21, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Sep 21, 2018
@tensorflowbutler tensorflowbutler removed the awaiting review Pull request awaiting review label Sep 22, 2018
@fchollet fchollet added the kokoro:force-run Tests on submitted change label Oct 2, 2018
@fchollet fchollet removed their request for review October 2, 2018 00:35
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Oct 2, 2018
@yanboliang
Copy link
Contributor Author

I think the test failures are non-relevant.

@tensorflow-copybara tensorflow-copybara merged commit 039ddaa into tensorflow:master Oct 4, 2018
tensorflow-copybara pushed a commit that referenced this pull request Oct 4, 2018
PiperOrigin-RevId: 215760505
@yanboliang yanboliang deleted the metrics branch October 4, 2018 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes ready to pull PR ready for merge process
Projects
None yet
8 participants