mindspore.nn.set_rng_state

查看源文件
mindspore.nn.set_rng_state(seed, offset=None)[源代码]

设置默认生成器状态。

参数:
  • seed (int) - 默认生成器的种子。

  • offset (int,可选) - 默认生成器的偏移量,默认值是:None ,取 0

支持平台:

Ascend GPU CPU

样例:

>>> from mindspore.nn import set_rng_state, get_rng_state
>>> set_rng_state(10)
>>> print(get_rng_state())
(Tensor(shape=[], dtype=Int32, value= 10), Tensor(shape=[], dtype=Int32, value= 0))