aesara.tensor.extra_ops.to_one_hot#
- aesara.tensor.extra_ops.to_one_hot(y, nb_class, dtype=None)[source]#
Return a matrix where each row correspond to the one hot encoding of each element in
y.- Parameters:
y – A vector of integer value between
0andnb_class - 1.nb_class (int) – The number of class in
y.dtype (data-type) – The dtype of the returned matrix. Default
aesara.config.floatX.
- Returns:
A matrix of shape
(y.shape[0], nb_class), where each rowiis the one hot encoding of the correspondingy[i]value.- Return type:
object