-
Notifications
You must be signed in to change notification settings - Fork 398
Fix squeeze inside NeuralNetBinaryClassifier.infer #558
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
05ea797
to
381229c
Compare
Thanks for the PR. I think this change should be okay. Could you please add an entry to the CHANGES.md? |
Sure, I will rebase the commit. |
I added a test to show the bug and replaced the squeeze by a reshape (was not correct previously). |
ottonemo
approved these changes
Nov 15, 2019
skorch/tests/test_classifier.py
Outdated
@@ -235,6 +235,16 @@ def test_net_learns(self, net_cls, module_cls, data): | |||
valid_acc = net.history[-1, 'valid_acc'] | |||
assert valid_acc > 0.65 | |||
|
|||
def test_batch_size_one(self, net_cls, module_cls, data): | |||
X, y = data | |||
print("test", y.shape) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
print("test", y.shape) |
Previously y_infer.squeeze() removed all dimensions with single entries, which does not correspond to the docstring description. Instead, remove only the last dimension, if it contains a single entry (batch_size = 1). Add a test to show the bug.
I removed the print statement from the test and rebased the commit.
…On 15/11/2019 17:13, ottonemo wrote:
***@***.**** approved this pull request.
------------------------------------------------------------------------
In skorch/tests/test_classifier.py
<#558 (comment)>:
> @@ -235,6 +235,16 @@ def test_net_learns(self, net_cls, module_cls, data):
valid_acc = net.history[-1, 'valid_acc']
assert valid_acc > 0.65
+ def test_batch_size_one(self, net_cls, module_cls, data):
+ X, y = data
+ print("test", y.shape)
⬇️ Suggested change
- print("test", y.shape)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#558?email_source=notifications&email_token=ABKQM3YONALGCA62AOI4CPTQT3DEPA5CNFSM4JMFX6EKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCLX64EQ#pullrequestreview-317713938>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKQM32MW3NLRPM2PX7KYPDQT3DEPANCNFSM4JMFX6EA>.
|
Thank you very much for the bugfix. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously y_infer.squeeze() removed all dimensions with single entries,
which does not correspond to the docstring description. Instead, remove
only the last dimension, if it contains a single entry.