mindspore.dataset.config.set_seed

View Source On Gitee
mindspore.dataset.config.set_seed(seed)

Set the seed for the random number generator in data pipeline.

The seed can be set to control the initial state of the random generator for the purpose of fixing the result of random number generation.

Note

This interface will set the random seed of the random, numpy.random and mindspore.dataset modules to the specified value at the same time.

Parameters

seed (int) – The desired seed. Must be non-negative.

Raises

Examples

>>> # Set a new global configuration value for the seed value.
>>> # Operations with randomness will use the seed value to generate random values.
>>> import mindspore.dataset as ds
>>> ds.config.set_seed(1000)