<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/nn.py#L2513-L2541) |

CTC (Connectionist Temporal Classification) loss.

#### View aliases


**Main aliases**

[`tf.keras.ops.nn.ctc_loss`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/ctc_loss)

<br />

    tf.keras.ops.ctc_loss(
        target, output, target_length, output_length, mask_index=0
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `target` | A tensor of shape `(batch_size, max_length)` containing the true labels in integer format. |
| `output` | A tensor of shape `(batch_size, max_length, num_classes)` containing logits (the output of your model). |
| `target_length` | A tensor of shape `(batch_size,)` containing the true label lengths. |
| `output_length` | A tensor of shape `(batch_size,)` containing the output lengths. |
| `mask_index` | The index of the mask character in the vocabulary. Defaults to `0`. |

<br />