Skip to content

Commit b4fb3dd

Browse files
committed
Edited codeblock 7.26 (reduced number of changes as mentioned)
1 parent 3510a45 commit b4fb3dd

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

chapter07_working-with-keras.ipynb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
"colab_type": "text"
77
},
88
"source": [
9-
"This is a companion notebook for the book [Deep Learning with Python, Second Edition](https://www.manning.com/books/deep-learning-with-python-second-edition?a_aid=keras&a_bid=76564dff). For readability, it only contains runnable code blocks and section titles, and omits everything else in the book: text paragraphs, figures, and pseudocode.\n\n**If you want to be able to follow what's going on, I recommend reading the notebook side by side with your copy of the book.**\n\nThis notebook was generated for TensorFlow 2.6."
9+
"This is a companion notebook for the book [Deep Learning with Python, Second Edition](https://www.manning.com/books/deep-learning-with-python-second-edition?a_aid=keras&a_bid=76564dff). For readability, it only contains runnable code blocks and section titles, and omits everything else in the book: text paragraphs, figures, and pseudocode.\n",
10+
"\n",
11+
"**If you want to be able to follow what's going on, I recommend reading the notebook side by side with your copy of the book.**\n",
12+
"\n",
13+
"This notebook was generated for TensorFlow 2.6."
1014
]
1115
},
1216
{
@@ -1372,8 +1376,8 @@
13721376
" with tf.GradientTape() as tape:\n",
13731377
" predictions = self(inputs, training=True)\n",
13741378
" loss = self.compiled_loss(targets, predictions)\n",
1375-
" gradients = tape.gradient(loss, model.trainable_weights)\n",
1376-
" optimizer.apply_gradients(zip(gradients, model.trainable_weights))\n",
1379+
" gradients = tape.gradient(loss, self.trainable_weights)\n",
1380+
" self.optimizer.apply_gradients(zip(gradients, self.trainable_weights))\n",
13771381
" self.compiled_metrics.update_state(targets, predictions)\n",
13781382
" return {m.name: m.result() for m in self.metrics}"
13791383
]
@@ -1417,9 +1421,9 @@
14171421
"toc_visible": true
14181422
},
14191423
"kernelspec": {
1420-
"display_name": "Python 3",
1424+
"display_name": "alan-env",
14211425
"language": "python",
1422-
"name": "python3"
1426+
"name": "alan-env"
14231427
},
14241428
"language_info": {
14251429
"codemirror_mode": {
@@ -1431,9 +1435,9 @@
14311435
"name": "python",
14321436
"nbconvert_exporter": "python",
14331437
"pygments_lexer": "ipython3",
1434-
"version": "3.7.0"
1438+
"version": "3.8.10"
14351439
}
14361440
},
14371441
"nbformat": 4,
1438-
"nbformat_minor": 0
1439-
}
1442+
"nbformat_minor": 1
1443+
}

0 commit comments

Comments
 (0)