Skip to content

Commit 44691df

Browse files
authored
Fix metrics in compile_and_fit
Pass a `loss` model into the `metrics` argument causes an error while trying to save and load the model: ``` TypeError: __init__() got an unexpected keyword argument 'reduction' while trying to load keras model ``` Reproduce: 1. Follow the guide and build a model 2. Save the model using `model.save(path)` 3. Load the model using `tf.keras.models.load_model(path)`
1 parent cf5f08d commit 44691df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

site/en/tutorials/keras/overfit_and_underfit.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@
536536
" model.compile(optimizer=optimizer,\n",
537537
" loss=tf.keras.losses.BinaryCrossentropy(from_logits=True),\n",
538538
" metrics=[\n",
539-
" tf.keras.losses.BinaryCrossentropy(\n",
539+
" tf.keras.metrics.BinaryCrossentropy(\n",
540540
" from_logits=True, name='binary_crossentropy'),\n",
541541
" 'accuracy'])\n",
542542
"\n",

0 commit comments

Comments
 (0)