# tf.keras.losses.categorical_hinge

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/keras/losses/categorical_hinge) | [![](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/losses.py#L861-L877) |

Computes the categorical hinge loss between `y_true` and `y_pred`.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.keras.losses.categorical_hinge(
        y_true, y_pred
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `y_true` | The ground truth values. `y_true` values are expected to be -1 or 1. If binary (0 or 1) labels are provided they will be converted to -1 or 1. |
| `y_pred` | The predicted values. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor. ||

<br />