-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Error out of default_collate for lists of unequal size #38492
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
Conversation
💊 CI failures summary and remediationsAs of commit d30f02b (more details on the Dr. CI page):
🕵️ 2 new failures recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
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.
could you add a test in test_dataloader.py
too? something that asserts default_collate raises is fine!
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.
Thank you :)
@pytorchbot merge this please |
Thanks for taking a look @ssnl! |
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.
@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Fix issue #23141
In the below example
default_collate
collates each element of the list. Since the second element isn't present in all samples, it is discarded:Yields
Based on discussion in the issue, it seems the best course of action is to error out in this case. This seems consistent with what is done for tensor elements, as seen in TensorShape.cpp line 1066 which is called when
torch.stack
is called. In this PR, I introduce a similar message to error out for lists.@ssnl