@@ -1031,7 +1031,7 @@ def approx_fprime(xk, f, epsilon=_epsilon, *args):
1031
1031
args = args , f0 = f0 )
1032
1032
1033
1033
1034
- @_transition_to_rng ("seed" , position_num = 6 , replace_doc = False )
1034
+ @_transition_to_rng ("seed" , position_num = 6 )
1035
1035
def check_grad (func , grad , x0 , * args , epsilon = _epsilon ,
1036
1036
direction = 'all' , rng = None ):
1037
1037
r"""Check the correctness of a gradient function by comparing it against a
@@ -1057,35 +1057,15 @@ def check_grad(func, grad, x0, *args, epsilon=_epsilon,
1057
1057
using `func`. By default it is ``'all'``, in which case, all
1058
1058
the one hot direction vectors are considered to check `grad`.
1059
1059
If `func` is a vector valued function then only ``'all'`` can be used.
1060
- rng : {None, int, `numpy.random.Generator`}, optional
1061
- If `rng` is passed by keyword, types other than `numpy.random.Generator` are
1060
+ rng : `numpy.random.Generator`, optional
1061
+ Pseudorandom number generator state. When `rng` is None, a new
1062
+ `numpy.random.Generator` is created using entropy from the
1063
+ operating system. Types other than `numpy.random.Generator` are
1062
1064
passed to `numpy.random.default_rng` to instantiate a ``Generator``.
1063
- If `rng` is already a ``Generator`` instance, then the provided instance is
1064
- used. Specify `rng` for repeatable function behavior.
1065
-
1066
- If this argument is passed by position or `seed` is passed by keyword,
1067
- legacy behavior for the argument `seed` applies:
1068
-
1069
- - If `seed` is None (or `numpy.random`), the `numpy.random.RandomState`
1070
- singleton is used.
1071
- - If `seed` is an int, a new ``RandomState`` instance is used,
1072
- seeded with `seed`.
1073
- - If `seed` is already a ``Generator`` or ``RandomState`` instance then
1074
- that instance is used.
1075
-
1076
- .. versionchanged:: 1.15.0
1077
- As part of the `SPEC-007 <https://scientific-python.org/specs/spec-0007/>`_
1078
- transition from use of `numpy.random.RandomState` to
1079
- `numpy.random.Generator`, this keyword was changed from `seed` to `rng`.
1080
- For an interim period, both keywords will continue to work, although only
1081
- one may be specified at a time. After the interim period, function calls
1082
- using the `seed` keyword will emit warnings. The behavior of both `seed`
1083
- and `rng` are outlined above, but only the `rng` keyword should be used in
1084
- new code.
1085
-
1086
- The random numbers generated with this seed affect the random vector
1087
- along which gradients are computed to check ``grad``. Note that `seed`
1088
- is only used when `direction` argument is set to `'random'`.
1065
+
1066
+ The random numbers generated affect the random vector along which gradients
1067
+ are computed to check ``grad``. Note that `rng` is only used when `direction`
1068
+ argument is set to `'random'`.
1089
1069
1090
1070
Returns
1091
1071
-------
0 commit comments