We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bad8d20 commit 0ba554bCopy full SHA for 0ba554b
pytensor/gradient.py
@@ -1770,14 +1770,9 @@ def verify_grad(
1770
if rel_tol is None:
1771
rel_tol = max(_type_tol[str(p.dtype)] for p in pt)
1772
1773
+ # Initialize RNG if not provided
1774
if rng is None:
- raise TypeError(
1775
- "rng should be a valid instance of "
1776
- "numpy.random.RandomState. You may "
1777
- "want to use tests.unittest"
1778
- "_tools.verify_grad instead of "
1779
- "pytensor.gradient.verify_grad."
1780
- )
+ rng = np.random.default_rng()
1781
1782
# We allow input downcast in `function`, because `numeric_grad` works in
1783
# the most precise dtype used among the inputs, so we may need to cast
0 commit comments