Skip to content

Commit

Permalink
[scipy] Use NumPy functions rather than their deprecated aliases in S…
Browse files Browse the repository at this point in the history
…ciPy's namespace.

SciPy 1.12.0 removes a number of functions from the scipy namespace that were reexports of NumPy APIs: https://docs.scipy.org/doc/scipy/release/1.12.0-notes.html#expired-deprecations

This change updates users to use the NumPy names instead.

PiperOrigin-RevId: 651786100
  • Loading branch information
hawkinsp authored and copybara-github committed Jul 16, 2024
1 parent 1451479 commit 863e289
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trax/data/tf_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ def compute_single_result(op_name, num_args):
elif op_name == 'gain_percent':
return 100 + num_args[0]
elif op_name == 'gcd':
return scipy.gcd(int(num_args[0]), int(num_args[1]))
return np.gcd(int(num_args[0]), int(num_args[1]))
elif op_name == 'inverse':
if num_args[0] != 0:
return 1 / num_args[0]
Expand Down Expand Up @@ -1961,7 +1961,7 @@ def single_op_to_python_command(op_name, num_args):
elif op_name == 'gain_percent':
return '100 + {}'.format(num_args[0])
elif op_name == 'gcd':
return 'scipy.gcd(int({}), int({}))'.format(num_args[0], num_args[1])
return 'np.gcd(int({}), int({}))'.format(num_args[0], num_args[1])
elif op_name == 'inverse':
# safe inverse
if num_args[0] != 0:
Expand Down

0 comments on commit 863e289

Please sign in to comment.