Skip to content

Add a resize hook to native_layer_norm (#24378) - #24378

Open
psiddh wants to merge 1 commit into
pytorch:mainfrom
psiddh:export-D127010333
Open

psiddh wants to merge 1 commit into
pytorch:mainfrom
psiddh:export-D127010333

Conversation

@psiddh

@psiddh psiddh commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

native_layer_norm kept its build-time shape when the sequence length changed, so the next op failed to resize.
It now resizes with its input, and the partitioner keeps layer norms over more than the last non-unit dim on CPU, where before they were delegated and computed wrong values.
This unblocks dynamic-length transformers such as on-device text-to-speech in the browser.
Follow-up (pre-existing, unchanged here): weight-only or bias-only layer norms and a dynamic normalized dim are still delegated.

Differential Revision: D127010333

Copilot AI balanced review requested due to automatic review settings October 31, 2026 07:30
@pytorch-bot

pytorch-bot Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 87b0be3 with merge base a84676e (image):
💚 Looks good so far! There are no failures yet. 💚

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 Oct 31, 2026
@meta-codesync

meta-codesync Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown

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.

psiddh added a commit to psiddh/executorch that referenced this pull request Oct 31, 2026
Summary:

native_layer_norm kept its build-time shape when the sequence length changed, so the next op failed to resize.
It now resizes with its input, and the partitioner keeps layer norms over more than the last non-unit dim on CPU, where before they were delegated and computed wrong values.
This unblocks dynamic-length transformers such as on-device text-to-speech in the browser.
Follow-up (pre-existing, unchanged here): weight-only or bias-only layer norms and a dynamic normalized dim are still delegated.

Differential Revision: D127010333
@meta-codesync meta-codesync Bot changed the title Add a resize hook to native_layer_norm Add a resize hook to native_layer_norm (#24378) Oct 31, 2026
@psiddh
psiddh force-pushed the export-D127010333 branch from 09ea938 to b059e3d Compare October 31, 2026 07:31
psiddh added a commit to psiddh/executorch that referenced this pull request Oct 31, 2026
Summary:

native_layer_norm kept its build-time shape when the sequence length changed, so the next op failed to resize.
It now resizes with its input, and the partitioner keeps layer norms over more than the last non-unit dim on CPU, where before they were delegated and computed wrong values.
This unblocks dynamic-length transformers such as on-device text-to-speech in the browser.
Follow-up (pre-existing, unchanged here): weight-only or bias-only layer norms and a dynamic normalized dim are still delegated.

Differential Revision: D127010333
@psiddh
psiddh force-pushed the export-D127010333 branch from b059e3d to 2fc0293 Compare October 31, 2026 07:33
Summary:

native_layer_norm kept its build-time shape when the sequence length changed, so the next op failed to resize.
It now resizes with its input, and the partitioner keeps layer norms over more than the last non-unit dim on CPU, where before they were delegated and computed wrong values.
This unblocks dynamic-length transformers such as on-device text-to-speech in the browser.
Follow-up (pre-existing, unchanged here): weight-only or bias-only layer norms and a dynamic normalized dim are still delegated.

Differential Revision: D127010333
@psiddh
psiddh force-pushed the export-D127010333 branch from 2fc0293 to 87b0be3 Compare November 7, 2026 19:13
Copilot AI balanced review requested due to automatic review settings November 7, 2026 19:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

psiddh added a commit to psiddh/executorch that referenced this pull request Nov 7, 2026
Summary:

native_layer_norm kept its build-time shape when the sequence length changed, so the next op failed to resize.
It now resizes with its input, and the partitioner keeps layer norms over more than the last non-unit dim on CPU, where before they were delegated and computed wrong values.
This unblocks dynamic-length transformers such as on-device text-to-speech in the browser.
Follow-up (pre-existing, unchanged here): weight-only or bias-only layer norms and a dynamic normalized dim are still delegated.

Differential Revision: D127010333

This branch has not been deployed

No deployments
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. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants