# tf.keras.callbacks.CallbackList

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L180-L570) |

Container abstracting a list of callbacks.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.keras.callbacks.CallbackList`](https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/CallbackList)

<br />

    tf.keras.callbacks.CallbackList(
        callbacks=None, add_history=False, add_progbar=False, model=None, **params
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `callbacks` | List of `Callback` instances. |
| `add_history` | Whether a `History` callback should be added, if one does not already exist in the `callbacks` list. |
| `add_progbar` | Whether a `ProgbarLogger` callback should be added, if one does not already exist in the `callbacks` list. |
| `model` | The `Model` these callbacks are used with. |
| `**params` | If provided, parameters will be passed to each `Callback` via [`Callback.set_params`](https://www.tensorflow.org/versions/r2.7/api_docs/python/tf/keras/callbacks/Callback#set_params). |

<br />

## Methods

### `append`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L272-L273)

    append(
        callback
    )

### `on_batch_begin`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L379-L381)

    on_batch_begin(
        batch, logs=None
    )

### `on_batch_end`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L383-L385)

    on_batch_end(
        batch, logs=None
    )

### `on_epoch_begin`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L387-L399)

    on_epoch_begin(
        epoch, logs=None
    )

Calls the `on_epoch_begin` methods of its callbacks.

This function should only be called during TRAIN mode.

<br />

<br />

<br />

| Args ||
|---|---|
| `epoch` | Integer, index of epoch. |
| `logs` | Dict. Currently no data is passed to this argument for this method but that may change in the future. |

<br />

### `on_epoch_end`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L401-L414)

    on_epoch_end(
        epoch, logs=None
    )

Calls the `on_epoch_end` methods of its callbacks.

This function should only be called during TRAIN mode.

<br />

<br />

<br />

| Args ||
|---|---|
| `epoch` | Integer, index of epoch. |
| `logs` | Dict, metric results for this training epoch, and for the validation epoch if validation is performed. Validation result keys are prefixed with `val_`. |

<br />

### `on_predict_batch_begin`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L460-L470)

    on_predict_batch_begin(
        batch, logs=None
    )

Calls the `on_predict_batch_begin` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `batch` | Integer, index of batch within the current epoch. |
| `logs` | Dict, contains the return value of `model.predict_step`, it typically returns a dict with a key 'outputs' containing the model's outputs. |

<br />

### `on_predict_batch_end`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L472-L480)

    on_predict_batch_end(
        batch, logs=None
    )

Calls the `on_predict_batch_end` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `batch` | Integer, index of batch within the current epoch. |
| `logs` | Dict. Aggregated metric results up until this batch. |

<br />

### `on_predict_begin`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L526-L535)

    on_predict_begin(
        logs=None
    )

Calls the 'on_predict_begin\` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `logs` | Dict. Currently no data is passed to this argument for this method but that may change in the future. |

<br />

### `on_predict_end`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L537-L546)

    on_predict_end(
        logs=None
    )

Calls the `on_predict_end` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `logs` | Dict. Currently, no data is passed via this argument for this method, but that may change in the future. |

<br />

### `on_test_batch_begin`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L438-L448)

    on_test_batch_begin(
        batch, logs=None
    )

Calls the `on_test_batch_begin` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `batch` | Integer, index of batch within the current epoch. |
| `logs` | Dict, contains the return value of `model.test_step`. Typically, the values of the `Model`'s metrics are returned. Example: `{'loss': 0.2, 'accuracy': 0.7}`. |

<br />

### `on_test_batch_end`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L450-L458)

    on_test_batch_end(
        batch, logs=None
    )

Calls the `on_test_batch_end` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `batch` | Integer, index of batch within the current epoch. |
| `logs` | Dict. Aggregated metric results up until this batch. |

<br />

### `on_test_begin`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L504-L513)

    on_test_begin(
        logs=None
    )

Calls the `on_test_begin` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `logs` | Dict. Currently no data is passed to this argument for this method but that may change in the future. |

<br />

### `on_test_end`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L515-L524)

    on_test_end(
        logs=None
    )

Calls the `on_test_end` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `logs` | Dict. Currently, no data is passed via this argument for this method, but that may change in the future. |

<br />

### `on_train_batch_begin`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L416-L426)

    on_train_batch_begin(
        batch, logs=None
    )

Calls the `on_train_batch_begin` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `batch` | Integer, index of batch within the current epoch. |
| `logs` | Dict, contains the return value of `model.train_step`. Typically, the values of the `Model`'s metrics are returned. Example: `{'loss': 0.2, 'accuracy': 0.7}`. |

<br />

### `on_train_batch_end`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L428-L436)

    on_train_batch_end(
        batch, logs=None
    )

Calls the `on_train_batch_end` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `batch` | Integer, index of batch within the current epoch. |
| `logs` | Dict. Aggregated metric results up until this batch. |

<br />

### `on_train_begin`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L482-L491)

    on_train_begin(
        logs=None
    )

Calls the `on_train_begin` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `logs` | Dict. Currently, no data is passed via this argument for this method, but that may change in the future. |

<br />

### `on_train_end`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L493-L502)

    on_train_end(
        logs=None
    )

Calls the `on_train_end` methods of its callbacks.

<br />

<br />

<br />

| Args ||
|---|---|
| `logs` | Dict. Currently, no data is passed via this argument for this method, but that may change in the future. |

<br />

### `set_model`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L280-L285)

    set_model(
        model
    )

### `set_params`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L275-L278)

    set_params(
        params
    )

### `__iter__`

[View source](https://github.com/keras-team/keras/tree/v2.7.0/keras/callbacks.py#L548-L549)

    __iter__()