Ensure RNNCell variants don't broadcast#4074
Merged
apaszke merged 5 commits intopytorch:masterfrom Dec 11, 2017
Merged
Conversation
Contributor
|
There was some CI maintenance happening this morning -- retriggering build. @pytorchbot retest this please |
apaszke
reviewed
Dec 8, 2017
| test(nn.RNNCell, bad_hx, hidden_size) | ||
| test(nn.GRUCell, bad_hx, hidden_size) | ||
| test(nn.LSTMCell, (bad_hx, good_hx), hidden_size) | ||
| test(nn.LSTMCell, (good_hx, bad_hx), hidden_size) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
apaszke
reviewed
Dec 8, 2017
| test(nn.RNNCell, bad_hx, hidden_size) | ||
| test(nn.GRUCell, bad_hx, hidden_size) | ||
| test(nn.LSTMCell, (bad_hx, good_hx), hidden_size) | ||
| test(nn.LSTMCell, (good_hx, bad_hx), hidden_size) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
apaszke
approved these changes
Dec 9, 2017
| self.check_batch_size(input, hx[0], '[0]') | ||
| self.check_batch_size(input, hx[1], '[1]') | ||
| self.check_forward_inputs(input, hx[0], '[0]') | ||
| self.check_forward_inputs(input, hx[1], '[1]') |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
apaszke
approved these changes
Dec 11, 2017
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
* Ensure RNNCell variants don't broadcast * Fix lint * Add test for hidden_size=1 in RNNCell no broadcasting test * Prevent broadcasting for hidden_size and input_size * Isolate input checking from hidden size checking
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
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.
Fixes #3789.
Before this change the following behavior occurs:
RNNCell supports input/hidden broadcasting on CPU and GPU
GRUCell and LSTMCell support input/hidden broadcasting on CPU but not GPU
This makes it so that none of them support broadcasting and that a clear error message is thrown.
Test Plan
Unit test to check that runtime error is thrown