Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.seed function

PyTorch torch.seed function


PyTorch torch reference manual PyTorch torch reference manual

torch.seed is a function in PyTorch used to set the random seed and return a new seed value.

Function definition

torch.seed()


Usage examples

Example

import

torch

Set the random seed

seed

=

torch.

seed

(

)

print

(

"Set seed value:"

,

seed

)

Set the random seed again

seed2

=

torch.

seed

(

)

print

(

"New seed value:"

,

seed2

)


PyTorch torch reference manual PyTorch torch reference manual