Skip to content

Fix quantized_w8a32_gru output shape to preserve batch dimensions#17291

Open
ethansfng wants to merge 1 commit intopytorch:mainfrom
ethansfng:export-D92570517
Open

Fix quantized_w8a32_gru output shape to preserve batch dimensions#17291
ethansfng wants to merge 1 commit intopytorch:mainfrom
ethansfng:export-D92570517

Conversation

@ethansfng
Copy link
Contributor

Summary:
The meta function for quantized_w8a32_gru returned shape (2, hidden_dim),
dropping the batch dimensions of the hidden state. After the fusion pass replaces
aten.gru.input with the custom op, getitem[0] on the output produced shape
(hidden_dim,) instead of the original (batch, ..., hidden_dim), causing a
shape mismatch with the reference output and NaN in the comparison.

Fix the meta function to return (2, *hidden.shape) to preserve all dimensions.
Also update the reference implementation to handle 3D hidden states and preserve
the original shape in the output, consistent with the shape fix applied to
quantized_w8a32_conv in D84745967.

Differential Revision: D92570517

Summary:
The meta function for `quantized_w8a32_gru` returned shape `(2, hidden_dim)`,
dropping the batch dimensions of the hidden state. After the fusion pass replaces
`aten.gru.input` with the custom op, `getitem[0]` on the output produced shape
`(hidden_dim,)` instead of the original `(batch, ..., hidden_dim)`, causing a
shape mismatch with the reference output and NaN in the comparison.

Fix the meta function to return `(2, *hidden.shape)` to preserve all dimensions.
Also update the reference implementation to handle 3D hidden states and preserve
the original shape in the output, consistent with the shape fix applied to
`quantized_w8a32_conv` in D84745967.

Differential Revision: D92570517
@pytorch-bot
Copy link

pytorch-bot bot commented Feb 7, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17291

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 1 Unrelated Failure

As of commit 09daf81 with merge base 7823792 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 7, 2026
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Feb 7, 2026

@ethansfng has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92570517.

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant