tf.contrib.layers.one_hot_encoding
Stay organized with collections
Save and categorize content based on your preferences.
Transform numeric labels into onehot_labels using 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
)
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.
|
Returns |
One-hot encoding of the labels.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.layers.one_hot_encoding\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/layers/python/layers/layers.py#L2540-L2566) |\n\nTransform numeric labels into onehot_labels using [`tf.one_hot`](../../../tf/one_hot). \n\n tf.contrib.layers.one_hot_encoding(\n labels, num_classes, on_value=1.0, off_value=0.0, outputs_collections=None,\n scope=None\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------------|----------------------------------|\n| `labels` | \\[batch_size\\] target labels. |\n| `num_classes` | Total number of classes. |\n| `on_value` | A scalar defining the on-value. |\n| `off_value` | A scalar defining the off-value. |\n| `outputs_collections` | Collection to add the outputs. |\n| `scope` | Optional scope for name_scope. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| One-hot encoding of the labels. ||\n\n\u003cbr /\u003e"]]