Formatted callback.py to render correctly
Updated some formatting to render the code block correctly
@@ -639,22 +639,23 @@ class Callback:
2. You will need to manually call all the `on_*` methods at the appropriate
locations in your loop. Like this:
- ```
- callbacks = tf.keras.callbacks.CallbackList([...])
- callbacks.append(...)
-
- callbacks.on_train_begin(...)
- for epoch in range(EPOCHS):
- callbacks.on_epoch_begin(epoch)
- for i, data in dataset.enumerate():
- callbacks.on_train_batch_begin(i)
- batch_logs = model.train_step(data)
- callbacks.on_train_batch_end(i, batch_logs)
- epoch_logs = ...
- callbacks.on_epoch_end(epoch, epoch_logs)
- final_logs=...
- callbacks.on_train_end(final_logs)
- ```
+ Example:
+
+ >>> callbacks = tf.keras.callbacks.CallbackList([...])
+ >>> callbacks.append(...)
+
+ >>> callbacks.on_train_begin(...)
+ >>> for epoch in range(EPOCHS):
+ ... callbacks.on_epoch_begin(epoch)
+ ... for i, data in dataset.enumerate():
+ ... callbacks.on_train_batch_begin(i)
+ ... batch_logs = model.train_step(data)
+ ... callbacks.on_train_batch_end(i, batch_logs)
+ ... epoch_logs = ...
+ ... callbacks.on_epoch_end(epoch, epoch_logs)
+ >>> final_logs=...
+ >>> callbacks.on_train_end(final_logs)
+
Attributes:
params: Dict. Training parameters
