Skip to content

get_rng_state

torch.tvarant.get_rng_state(device='tvarant')  Tensor

Returns the RNG state tensor for the Tvarant generator.

Return the RNG state tensor for device.

Parameters:

Name Type Description Default
device Union[int, str, device]

Device specifier. Accepted for API compatibility; only the single Tvarant generator is used today.

'tvarant'

Returns:

Type Description
Tensor

torch.Tensor: Opaque byte state suitable for set_rng_state.

Source code in torch_tvarant/tvarant/__init__.py
147
148
149
150
151
152
153
154
155
156
157
158
def get_rng_state(device: Union[int, str, torch.device] = "tvarant") -> torch.Tensor:
    """Return the RNG state tensor for ``device``.

    Args:
        device: Device specifier. Accepted for API compatibility; only the
            single Tvarant generator is used today.

    Returns:
        torch.Tensor: Opaque byte state suitable for ``set_rng_state``.
    """
    _ = device
    return _C.get_rng_state()