You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So that multiple devices and outside random number generation don't interfere with the reproducibility of a given device, we should assign each simulator device a Generator and pull random numbers from that generator.
To implement this:
QubitDevice initialization accepts a optional seed keyword. This seed can be anything accepted by pennylane.numpy.random.default_rng(seed).
Initialization of device creates a _rng attribute from provided seed.
A new method, reset_rng(seed), redefines the _rng attribute with a new seed.
Any random number generator (Line 484) pulls from _rng.
Update documentation for QubitDevice and inheriting devices in pennylane/devices
Write tests
As this is only possible for NumPy v1.17.0 onward, this may require consideration about versioning. According to NumPy's deprecation recommendations, support for version 1.16.0 and earlier could have been dropped Jan 13, 2021, so we may be fine.
The text was updated successfully, but these errors were encountered:
Currently, PennyLane devices use legacy numpy random number generation, see NumPy documentation and PR #1267. In particular, this random number generation occurs on
_qubit_device.py
Line 484.So that multiple devices and outside random number generation don't interfere with the reproducibility of a given device, we should assign each simulator device a Generator and pull random numbers from that generator.
To implement this:
QubitDevice
initialization accepts a optionalseed
keyword. This seed can be anything accepted bypennylane.numpy.random.default_rng(seed)
.Initialization of device creates a
_rng
attribute from provided seed.A new method,
reset_rng(seed)
, redefines the_rng
attribute with a new seed.Any random number generator (Line 484) pulls from
_rng
.Update documentation for
QubitDevice
and inheriting devices inpennylane/devices
Write tests
As this is only possible for NumPy v1.17.0 onward, this may require consideration about versioning. According to NumPy's deprecation recommendations, support for version 1.16.0 and earlier could have been dropped Jan 13, 2021, so we may be fine.
The text was updated successfully, but these errors were encountered: