# 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/master/keras/callbacks.py#L181-L567) |

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.6/api_docs/python/tf/keras/callbacks/Callback#set_params). |

<br />

## Methods

### `append`

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

    append(
        callback
    )

### `on_batch_begin`

[View source](https://github.com/keras-team/keras/tree/master/keras/callbacks.py#L378-L380)

    on_batch_begin(
        batch, logs=None
    )

### `on_batch_end`

[View source](https://github.com/keras-team/keras/tree/master/keras/callbacks.py#L382-L384)

    on_batch_end(
        batch, logs=None
    )

### `on_epoch_begin`

[View source](https://github.com/keras-team/keras/tree/master/keras/callbacks.py#L386-L398)

    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/master/keras/callbacks.py#L400-L413)

    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/master/keras/callbacks.py#L459-L469)

    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/master/keras/callbacks.py#L471-L479)

    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/master/keras/callbacks.py#L525-L534)

    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/master/keras/callbacks.py#L536-L545)

    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/master/keras/callbacks.py#L437-L447)

    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/master/keras/callbacks.py#L449-L457)

    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/master/keras/callbacks.py#L503-L512)

    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/master/keras/callbacks.py#L514-L523)

    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/master/keras/callbacks.py#L415-L425)

    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/master/keras/callbacks.py#L427-L435)

    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/master/keras/callbacks.py#L481-L490)

    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/master/keras/callbacks.py#L492-L501)

    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/master/keras/callbacks.py#L280-L285)

    set_model(
        model
    )

### `set_params`

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

    set_params(
        params
    )

### `__iter__`

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

    __iter__()