PyTorch torch.initial_seed Function
Pytorch torch Reference Manual
torch.initial_seedis a function in PyTorch used to return the current random seed.
Function Definition
torch.initial_seed()
Usage Example
Example
import torch
# Set random seed
torch.manual_seed(42)
# Get the current random seed
current_seed = torch.initial_seed()
print("Current random seed:", current_seed)
# Set random seed
torch.manual_seed(42)
# Get the current random seed
current_seed = torch.initial_seed()
print("Current random seed:", current_seed)
Other Extensions