google / trax

Trax — Deep Learning with Clear Code and Speed
Apache License 2.0
8.01k stars 813 forks source link

[NumPy] Replace numpy.asscalar(x) with x.item() in preparation for upgrading NumPy to 1.23. #1757

Closed copybara-service[bot] closed 1 year ago

copybara-service[bot] commented 1 year ago

[NumPy] Replace numpy.asscalar(x) with x.item() in preparation for upgrading NumPy to 1.23.

NumPy 1.23 removes numpy.asscalar() (https://numpy.org/doc/stable/release/1.23.0-notes.html#expired-deprecations), which has been deprecated since NumPy 1.16 (https://numpy.org/doc/stable/release/1.16.0-notes.html#new-deprecations).

x.item() should be identical to the previous implementation of numpy.asscalar(x) in every way.