# tf.contrib.layers.one_hot_encoding

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/layers/python/layers/layers.py#L2540-L2566) |

Transform numeric labels into onehot_labels using [`tf.one_hot`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/one_hot).

    tf.contrib.layers.one_hot_encoding(
        labels, num_classes, on_value=1.0, off_value=0.0, outputs_collections=None,
        scope=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `labels` | \[batch_size\] target labels. |
| `num_classes` | Total number of classes. |
| `on_value` | A scalar defining the on-value. |
| `off_value` | A scalar defining the off-value. |
| `outputs_collections` | Collection to add the outputs. |
| `scope` | Optional scope for name_scope. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| One-hot encoding of the labels. ||

<br />