# tf.keras.backend.ctc_batch_cost

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/keras/backend/ctc_batch_cost) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/backend.py#L5603-L5632) |

Runs CTC loss algorithm on each batch element.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.keras.backend.ctc_batch_cost`](https://www.tensorflow.org/api_docs/python/tf/keras/backend/ctc_batch_cost), \`tf.compat.v2.keras.backend.ctc_batch_cost\`

<br />

    tf.keras.backend.ctc_batch_cost(
        y_true, y_pred, input_length, label_length
    )

<br />

<br />

<br />

| ## Arguments ||
|---|---|
| `y_true` | tensor `(samples, max_string_length)` containing the truth labels. |
| `y_pred` | tensor `(samples, time_steps, num_categories)` containing the prediction, or output of the softmax. |
| `input_length` | tensor `(samples, 1)` containing the sequence length for each batch item in `y_pred`. |
| `label_length` | tensor `(samples, 1)` containing the sequence length for each batch item in `y_true`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Tensor with shape (samples,1) containing the CTC loss of each element. ||

<br />