W3cubDocs

/PyTorch 2.9

torch.initial_seed

torch.initial_seed() [source]

Returns the initial seed for generating random numbers as a Python long.

Note

The returned seed is for the default generator on CPU only.

Return type

int

© 2025, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.9/generated/torch.initial_seed.html