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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix result gathering with varying tensor shapes #3020

Merged
merged 7 commits into from
Aug 19, 2020

Conversation

awaelchli
Copy link
Member

@awaelchli awaelchli commented Aug 17, 2020

What does this PR do?

Fixes #3019

The critical test fails on master, but I added also more tests for the old behaviour.

Solution:

  • By default, we need to concatenate, because stacking would only work when the dataloader returns equal batch sizes. This is not the case in general.
  • If the tensors are scalar, we stack.
  • If stacking and concatenating both don't work, we gather into a list. At this point the user should be aware what they return and need to deal with it in their *_epoch_end.

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 馃檭

@pep8speaks
Copy link

pep8speaks commented Aug 17, 2020

Hello @awaelchli! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 馃嵒

Comment last updated at 2020-08-18 23:56:42 UTC

@awaelchli awaelchli added the bug Something isn't working label Aug 17, 2020
@codecov
Copy link

codecov bot commented Aug 17, 2020

Codecov Report

Merging #3020 into master will decrease coverage by 3%.
The diff coverage is 83%.

@@           Coverage Diff           @@
##           master   #3020    +/-   ##
=======================================
- Coverage      90%     87%    -3%     
=======================================
  Files          81      81            
  Lines        7644    8004   +360     
=======================================
+ Hits         6878    6967    +89     
- Misses        766    1037   +271     

@awaelchli awaelchli marked this pull request as ready for review August 17, 2020 19:52
@mergify mergify bot requested a review from a team August 17, 2020 19:53
@awaelchli
Copy link
Member Author

Let me know if you think there is a better place to put these tests.

@Borda
Copy link
Member

Borda commented Aug 17, 2020

Let me know if you think there is a better place to put these tests.

the location for tests is fine :]

@mergify mergify bot requested a review from a team August 18, 2020 13:33
@mergify mergify bot requested a review from a team August 18, 2020 14:05
@williamFalcon williamFalcon merged commit 9031dc3 into master Aug 19, 2020
@Borda Borda deleted the bugfix/result-stack branch August 20, 2020 21:44
@Borda Borda added this to the 0.9.0 milestone Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Results gathering with varying tensor shapes (e.g. last batch)
6 participants