Skip to content

Commit 660498d

Browse files
authored
Merge pull request #182 from krs131099/master
Edited codeblock 7.26: Made the CustomModel independent of previous model.
2 parents 5758781 + 9b68661 commit 660498d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

chapter07_working-with-keras.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,8 +1372,8 @@
13721372
" with tf.GradientTape() as tape:\n",
13731373
" predictions = self(inputs, training=True)\n",
13741374
" 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",
1375+
" gradients = tape.gradient(loss, self.trainable_weights)\n",
1376+
" self.optimizer.apply_gradients(zip(gradients, self.trainable_weights))\n",
13771377
" self.compiled_metrics.update_state(targets, predictions)\n",
13781378
" return {m.name: m.result() for m in self.metrics}"
13791379
]
@@ -1436,4 +1436,4 @@
14361436
},
14371437
"nbformat": 4,
14381438
"nbformat_minor": 0
1439-
}
1439+
}

0 commit comments

Comments
 (0)