Rate this Page

torch.manual_seed#

torch.manual_seed(seed)[source]#

Sets the seed for generating random numbers on all devices. Returns atorch.Generator object.

Parameters

seed (int) – The desired seed. Value must be within the inclusive range[-0x8000_0000_0000_0000, 0xffff_ffff_ffff_ffff]. Otherwise, a RuntimeErroris raised. Negative inputs are remapped to positive values with the formula0xffff_ffff_ffff_ffff + seed.

Return type

Generator