Skip to content

Commit

Permalink
Do not require RNG in 'verify_grad' (#1093)
Browse files Browse the repository at this point in the history
Co-authored-by: Mohit Kumar <[email protected]>
  • Loading branch information
aibit0111 and Mohit Kumar authored Nov 18, 2024
1 parent bad8d20 commit 0ba554b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pytensor/gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -1770,14 +1770,9 @@ def verify_grad(
if rel_tol is None:
rel_tol = max(_type_tol[str(p.dtype)] for p in pt)

# Initialize RNG if not provided
if rng is None:
raise TypeError(
"rng should be a valid instance of "
"numpy.random.RandomState. You may "
"want to use tests.unittest"
"_tools.verify_grad instead of "
"pytensor.gradient.verify_grad."
)
rng = np.random.default_rng()

# We allow input downcast in `function`, because `numeric_grad` works in
# the most precise dtype used among the inputs, so we may need to cast
Expand Down

0 comments on commit 0ba554b

Please sign in to comment.