Skip to content

Commit

Permalink
Numpy 2.0 deprecates part of their namespace (#1913)
Browse files Browse the repository at this point in the history
  • Loading branch information
tilakrayal authored Aug 21, 2024
1 parent a51db69 commit 3ce7f66
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
26 changes: 12 additions & 14 deletions guides/ipynb/writing_your_own_callbacks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -128,7 +128,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -144,8 +144,7 @@
" loss=\"mean_squared_error\",\n",
" metrics=[\"mean_absolute_error\"],\n",
" )\n",
" return model\n",
""
" return model\n"
]
},
{
Expand All @@ -159,7 +158,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -194,7 +193,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -256,8 +255,7 @@
"\n",
" def on_predict_batch_end(self, batch, logs=None):\n",
" keys = list(logs.keys())\n",
" print(\"...Predicting: end of batch {}; got log keys: {}\".format(batch, keys))\n",
""
" print(\"...Predicting: end of batch {}; got log keys: {}\".format(batch, keys))\n"
]
},
{
Expand All @@ -271,7 +269,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -309,7 +307,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -402,7 +400,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -429,7 +427,7 @@
" # The epoch the training stops at.\n",
" self.stopped_epoch = 0\n",
" # Initialize the best as infinity.\n",
" self.best = np.Inf\n",
" self.best = np.inf\n",
"\n",
" def on_epoch_end(self, epoch, logs=None):\n",
" current = logs.get(\"loss\")\n",
Expand Down Expand Up @@ -478,7 +476,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -587,4 +585,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
2 changes: 1 addition & 1 deletion guides/md/writing_your_own_callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class EarlyStoppingAtMinLoss(keras.callbacks.Callback):
# The epoch the training stops at.
self.stopped_epoch = 0
# Initialize the best as infinity.
self.best = np.Inf
self.best = np.inf

def on_epoch_end(self, epoch, logs=None):
current = logs.get("loss")
Expand Down
2 changes: 1 addition & 1 deletion guides/writing_your_own_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def on_train_begin(self, logs=None):
# The epoch the training stops at.
self.stopped_epoch = 0
# Initialize the best as infinity.
self.best = np.Inf
self.best = np.inf

def on_epoch_end(self, epoch, logs=None):
current = logs.get("loss")
Expand Down

0 comments on commit 3ce7f66

Please sign in to comment.