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

pack_padded_sequence: Check for empty (zero-element) tensors #21461

Closed
wants to merge 1 commit into from

Conversation

t-vi
Copy link
Collaborator

@t-vi t-vi commented Jun 6, 2019

Fixes: #20529

Thank you, @JamieCT for the bug report with reproducing script.

Fixes: pytorch#20529

Thank you, @JamieCT for the bug report with reproducing script.
Copy link
Contributor

@apaszke apaszke left a comment

Choose a reason for hiding this comment

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

Actually do we understand where does the segfault come from?

@t-vi
Copy link
Collaborator Author

t-vi commented Jun 6, 2019

Yes, it comes from the length check accessing the last element.

TORCH_CHECK(lengths[batch_size - 1] > 0,
"Length of all samples has to be greater than 0, but found an element "
"in 'lengths' that is <= 0");

Alternatively we could produce packed sequences with 0-element tensors, but I'm not sure that that fits well with the consumers' assumptions.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Jun 6, 2019
Summary:
Fixes: #20529

Thank you, JamieCT for the bug report with reproducing script.
Pull Request resolved: pytorch/pytorch#21461

Differential Revision: D15696183

Pulled By: ezyang

fbshipit-source-id: a93cde2c924f8447563c64ce8a1cf75fcee60a01
@facebook-github-bot
Copy link
Contributor

@ezyang merged this pull request in 3feb40d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault (core dumped) when passing empty Tensors to pack_padded_sequence
6 participants