Skip to content

fix(stubs): add torch.compile - #5373

Closed
mangeshraut712 wants to merge 1 commit into
meta:mainfrom
mangeshraut712:fix/torch-compile-stub
Closed

mangeshraut712 wants to merge 1 commit into
meta:mainfrom
mangeshraut712:fix/torch-compile-stub

Conversation

@mangeshraut712

Copy link
Copy Markdown
Contributor

Closes #5354.

Issue #5354 result

  • Added top-level torch.compile overloads to the PyTorch shape stubs instead of importing it from torch.compiler. This keeps stubs compatible with PyTorch 2.0, which has torch.compile but no torch.compiler namespace.
  • The overloads preserve callable types for both torch.compile(fn) and decorator use via torch.compile()(fn).
  • Added static regression checks for both call forms in test_public_attributes.py.

Validation

  • Focused Pyrefly suite: torch-public-attributes passed with PyTorch 2.0.1, where torch.compile is callable and torch.compiler is absent.
  • Ruff formatting check passed for the full checkout.
  • Ruff import sorting check passed. It emitted pre-existing invalid # noqa warnings in test_norms.py.
  • git diff --check passed.
  • The repository formatting/lint script could not start because cargo is not installed; it stopped during Rust formatting.

Commit

b5993e84155299e393ebee4e58227a919b329063 fix(stubs): add torch.compile

Working tree is clean. No push or PR was made.

@meta-codesync

meta-codesync Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D127484819. (Because this pull request was imported automatically, there will not be any future comments.)

@stroxler stroxler 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.

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync Bot closed this in 7875ac1 Oct 26, 2026
@meta-codesync meta-codesync Bot added the Merged label Oct 26, 2026
@meta-codesync

meta-codesync Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

This pull request has been merged in 7875ac1.

@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Hey — CodeSync landed this on main with me as the commit author (thanks). GitHub still shows the PR as closed not merged (mergedAt is null), so it does not show up in is:merged search or contributor merge counts.

Could you mark CodeSync landings as merged on the GitHub side (or reopen + merge via GitHub) so external contributors get the PR merge credit? Same issue on #5365 #5373 #5367 #5369.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

missing torch.compile

2 participants