Rate this Page

torch.accelerator.random.get_rng_state#

torch.accelerator.random.get_rng_state(device=None, /)[source]#

Return the RNG state of the default torch.Generator for the current accelerator as a torch.Tensor of dtype torch.uint8 for the specified accelerator device.

Parameters:

device (torch.device, str, int, optional) – The device to return the RNG state of. If not given, uses torch.accelerator.current_device_index() by default.

Returns:

the RNG state of the default generator for the specified device.

Return type:

torch.Tensor

Warning

This function eagerly initializes the accelerator runtime.