Skip to content

Commit

Permalink
[numpy] Fix users of NumPy APIs that are removed in NumPy 2.0.
Browse files Browse the repository at this point in the history
This change migrates users of APIs removed in NumPy 2.0 to their recommended replacements (https://numpy.org/doc/stable/numpy_2_0_migration_guide.html).

This CL makes the following changes in colab notebooks:
* np.NaN -> np.nan
* np.NAN -> np.nan
* np.Inf -> np.inf
* np.Infinity -> np.inf
* np.infty -> np.inf
* np.NINF -> -np.inf

PiperOrigin-RevId: 659627325
  • Loading branch information
hawkinsp authored and copybara-github committed Aug 5, 2024
1 parent f15a76e commit ba5a932
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion agent_based_epidemic_sim/learning/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")
load("@pip//:requirements.bzl", "requirement")
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")

licenses(["notice"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
"\n",
"def project(params):\n",
" \"\"\"Project residual parameters to nonnegative orthant.\"\"\"\n",
" params = np.clip(params, 0, np.infty)\n",
" params = np.clip(params, 0, np.inf)\n",
" return params\n",
"\n",
"def train(data, labels, weights_init, batch_size=100, num_iters=1000, lr=0.01):\n",
Expand Down
2 changes: 1 addition & 1 deletion agent_based_epidemic_sim/port/deps/status_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class ABSL_MUST_USE_RESULT StatusBuilder {
}
template <typename Adaptor>
auto With(Adaptor&& adaptor) && -> decltype(std::forward<Adaptor>(adaptor)(
std::move(*this))) {
std::move(*this))) {
return std::forward<Adaptor>(adaptor)(std::move(*this));
}

Expand Down

0 comments on commit ba5a932

Please sign in to comment.