PyTorch torch.get_rng_state Function


Pytorch torch 参考手册PyTorch torch Reference Manual

torch.get_rng_stateIt is a function in PyTorch used to return the state of the random number generator.

Function Definition

torch.get_rng_state()

Usage Example

Example

import torch

# Get the current random number generator state
rng_state = torch.get_rng_state()
print("Random number generator state:", rng_state)
print("State type:", type(rng_state))
print("State size:", rng_state.numel())

Pytorch torch 参考手册PyTorch torch Reference Manual

Other Extensions