PyTorch torch.seed Function
PyTorch torch Reference Manual
torch.seedis a function in PyTorch used to set the random seed and return the new seed value.
Function Definition
torch.seed()
Usage Example
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)
# 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)
Other Extensions