pytorch / pytorch/pytorch.github.io

Add a specific random seed to the post-install verification example

Open Beginner friendly
#2,117 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
285
Forks
317
PR merge metrics
No merged PRs in 30d

Description

📚 Documentation

The current Verification example generates a random matrix and says The output should be something similar to

I think it would be useful to add a line specifying an explicit random seed that would create a similar output each time you run the example

The example would then become something like

>>> import torch
>>> torch.manual_seed(1234)
<torch._C.Generator object at 0x2b5aa9011ef0>
>>> x = torch.rand(5, 3)
>>> print(x)
tensor([[0.0290, 0.4019, 0.2598],
        [0.3666, 0.0583, 0.7006],
        [0.0518, 0.4681, 0.6738],
        [0.3315, 0.7837, 0.5631],
        [0.7749, 0.8208, 0.2793]])

I have used the same random seed on 2 different Linux clusters and one Windows laptop, and I got the very same result. I was using the CPU version in the 3 cases, but I assume I would get the same output matrix on a GPU (I hope...)

>>> torch.cuda.is_available()
False

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Linux Verification example linked in the issue and inspect the website source for that section. Add an explicit random seed and matching example output, then verify that the documented CPU result is consistent with the stated example and that the verification steps remain accurate.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.