PyTorch torch.initial_seed Function


Pytorch torch 参考手册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)

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions