def _one_hot(indices, depth, on_value=None, off_value=None, axis=None, dtype=None, name=None):
    'One hot.'
    if (on_value is None):
        on_value = 1
    if (off_value is None):
        off_value = 0
    if (dtype is None):
        dtype = utils.common_dtype([on_value, off_value], np.float32)
    indices = np.array(indices)
    depth = np.array(depth)
    pred = (abs((np.arange(depth, dtype=indices.dtype) - indices[(..., np.newaxis)])) > 0)
    y_out = np.where(pred, np.array(off_value, dtype), np.array(on_value, dtype))
    if (axis is not None):
        y_out = np.moveaxis(y_out, (- 1), axis)
    return y_out
One hot.
def _one_hot(indices, depth, on_value=None, off_value=None, axis=None, dtype=None, name=None):
    
    if (on_value is None):
        on_value = 1
    if (off_value is None):
        off_value = 0
    if (dtype is None):
        dtype = utils.common_dtype([on_value, off_value], np.float32)
    indices = np.array(indices)
    depth = np.array(depth)
    pred = (abs((np.arange(depth, dtype=indices.dtype) - indices[(..., np.newaxis)])) > 0)
    y_out = np.where(pred, np.array(off_value, dtype), np.array(on_value, dtype))
    if (axis is not None):
        y_out = np.moveaxis(y_out, (- 1), axis)
    return y_out