Save the date! Google I/O returns May 18-20 Register now


TensorFlow 2 version View source on GitHub

Computes the one-hot representation of an integer tensor.

indices nD integer tensor of shape (batch_size, dim1, dim2, ... dim(n-1))
num_classes Integer, number of classes to consider.

(n + 1)D one hot representation of the input with shape (batch_size, dim1, dim2, ... dim(n-1), num_classes)

The one-hot tensor.