Skip to content

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

Description

@jypeter

📚 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions