set_rng_state

paddle. set_rng_state ( state_list, device=None ) [source]

Sets generator state for all device generators.

Parameters
  • state_list (list|tuple) – The device states to set back to device generators. state_list is obtained from get_rng_state().

  • device (str) – This parameter determines the specific running device. It can be cpu, gpu, xpu, Default is None. If None, return the generators of current device (specified by set_device).

Returns

None.

Examples

>>> import paddle
>>> sts = paddle.get_rng_state()
>>> paddle.set_rng_state(sts)