Skip to content

Commit d7c1a19

Browse files
committed
DOC: changes after gh21853
1 parent 4a0b07a commit d7c1a19

File tree

1 file changed

+9
-29
lines changed

1 file changed

+9
-29
lines changed

scipy/optimize/_optimize.py

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ def approx_fprime(xk, f, epsilon=_epsilon, *args):
10311031
args=args, f0=f0)
10321032

10331033

1034-
@_transition_to_rng("seed", position_num=6, replace_doc=False)
1034+
@_transition_to_rng("seed", position_num=6)
10351035
def check_grad(func, grad, x0, *args, epsilon=_epsilon,
10361036
direction='all', rng=None):
10371037
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,
10571057
using `func`. By default it is ``'all'``, in which case, all
10581058
the one hot direction vectors are considered to check `grad`.
10591059
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
10621064
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'`.
10891069
10901070
Returns
10911071
-------

0 commit comments

Comments
 (0)