'Generate optree for converting `indices` to a onehot representation.
Arguments:
indices (Tensor): Elements must be of numpy integer type for gpu
onehot to work.
axis (int): the axis along the feature length dimension
out (Tensor, optional): where the result will be stored. If out is
None, only the op-tree will be returned.
Returns:
OpTreeNode: the resulting op-tree'

def onehot(self, indices, axis, out=None):

    if (axis not in (0, 1)):
        raise ValueError('bad    axis    for    onehot')
    assert (indices.dtype in [np.dtype(np.int32), np.dtype(np.uint32)]), ('onehot    indices    should    be    int32    or    uint32,    got    ' + str(indices.dtype))
    return OpTreeNode.build('onehot', None, None, idx=indices, axis=axis, out=out)
