(size, val)
return vec
Converts target into one-hot.

    Args:
        size: Size of vector.
        val: Integer in range [0, size].
    Returns:
         vec: one-hot vector with a 1 in the val element.
Converts target into one-hot.
Converts target into one - hot .
def val_to_vec(size, val):
    """Converts target into one-hot.

    Args:
        size: Size of vector.
        val: Integer in range [0, size].
    Returns:
         vec: one-hot vector with a 1 in the val element.
    """
    assert 0 <= val < size
    vec = [0 for _ in range(size)]
    vec[int(val)] = 1
    return vec
def val_to_vec ( size , val ) : assert 0 <= val < size vec = [ 0 for _ in range ( size ) ] vec [ int ( val ) ] = 1 return vec