Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Update docstrings for torch/random.py #125443

Merged
merged 1 commit into from
May 13, 2024

Conversation

saitcakmak
Copy link
Contributor

Updates the docstrings for torch/random.py to clarify what device / RNG each function operates on.

While trying to understand the difference between

state = torch.random.get_rng_state()
some_code
torch.random.set_rng_state(state)

and

with torch.random.fork_rng():
    some_code

I found out that there was a note about this in the docstring that wasn't being rendered on the website. I fixed that note and added additional clarifications on other functions in this file.

Test Plan:
Built the docs and verified that everything renders correctly.

Screenshot 2024-04-30 at 2 22 08 PM Screenshot 2024-04-30 at 2 22 13 PM

Cherry picked: #125265
Approved by: https://github.com/Balandat, https://github.com/lezcano

Updates the docstrings for torch/random.py to clarify what device / RNG each function operates on.

While trying to understand the difference between
```
state = torch.random.get_rng_state()
some_code
torch.random.set_rng_state(state)
```
and
```
with torch.random.fork_rng():
    some_code
```
I found out that there was a note about this in the docstring that wasn't being rendered on the website. I fixed that note and added additional clarifications on other functions in this file.

Test Plan:
Built the docs and verified that everything renders correctly.

<img width="911" alt="Screenshot 2024-04-30 at 2 22 08 PM" src="https://github.com/pytorch/pytorch/assets/9263852/f219bc35-89bd-4f5b-ba60-255b089499a4">

<img width="901" alt="Screenshot 2024-04-30 at 2 22 13 PM" src="https://github.com/pytorch/pytorch/assets/9263852/c141e7fa-afc9-4c66-b460-96668ce35606">

Pull Request resolved: pytorch#125265
Approved by: https://github.com/Balandat, https://github.com/lezcano
Copy link

pytorch-bot bot commented May 2, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 5a2ca8c with merge base 86a2d67 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@atalman atalman merged commit 1199df4 into pytorch:release/2.3 May 13, 2024
98 checks passed
@saitcakmak saitcakmak deleted the cherry-pick-random-docs branch May 15, 2024 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants