Skip to content

Introduce tensor subclass for stateless RNG API algorithm choice - #177898

Closed
jbschlosser wants to merge 53 commits into
gh/jbschlosser/259/basefrom
gh/jbschlosser/259/head
Closed

jbschlosser wants to merge 53 commits into
gh/jbschlosser/259/basefrom
gh/jbschlosser/259/head

Conversation

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Mar 19, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 2 New Failures, 14 Pending

As of commit 34b293b with merge base d39020e (image):

🟡 GREEN LIGHT - PR requires human review:

  • Triviality
    • Adds new PRNGKey and Philox4x32_10Key wrapper tensor subclasses with __torch_dispatch__ and flatten/unflatten hooks in torch/func/_random.py
    • key() now returns a Philox4x32_10Key subclass instead of a plain uint64 tensor, so every split/fold_in/uniform_/normal_/randint_ call takes a new dispatch path
  • Design questions for a reviewer
    • Subclass design affects torch.compile tracing and dispatch behavior; that is an API design choice a human should approve
    • Removes the key: torch.Tensor annotations from normal and uniform, which is not a narrowing
  • Tests
    • test_1d_shape in test/test_stateless_rng.py drops the keys.dtype == torch.uint64 assertion, and nothing tests the new subclass paths beyond one assertIsInstance

reason: not_trivial
Reviewed commit: 34b293b

Inference job

🐛 Report a wrong verdict

NEW FAILURES - The following jobs have failed:

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

@pytorch-bot

pytorch-bot Bot commented Mar 19, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

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

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@pytorchgreenlight pytorchgreenlight Bot added the GL/human GreenLight marked as needing human review label Oct 27, 2026
[ghstack-poisoned]
@jbschlosser

Copy link
Copy Markdown
Contributor Author

Eh, not worth it

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

Labels

GL/human GreenLight marked as needing human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant