(int_list, one_hot_length)
return [[1.0 if j == i else 0.0 for j in range(one_hot_length)]
          for i in int_list]
Convert each int to a one-hot vector.

  A one-hot vector is 0 everywhere except at the index equal to the
  encoded value.

  For example: 5 as a one-hot vector is [0, 0, 0, 0, 0, 1, 0, 0, 0, ...]

  Args:
    int_list: A list of ints, each of which will get a one-hot encoding.
    one_hot_length: The length of the one-hot vector to be created.
  Returns:
    A list of one-hot encodings of the ints.
Convert each int to a one-hot vector.
Convert each int to a one - hot vector .
def make_onehot(int_list, one_hot_length):
  """Convert each int to a one-hot vector.

  A one-hot vector is 0 everywhere except at the index equal to the
  encoded value.

  For example: 5 as a one-hot vector is [0, 0, 0, 0, 0, 1, 0, 0, 0, ...]

  Args:
    int_list: A list of ints, each of which will get a one-hot encoding.
    one_hot_length: The length of the one-hot vector to be created.
  Returns:
    A list of one-hot encodings of the ints.
  """
  return [[1.0 if j == i else 0.0 for j in range(one_hot_length)]
          for i in int_list]
def make_onehot ( int_list , one_hot_length ) : return [ [ 1.0 if j == i else 0.0 for j in range ( one_hot_length ) ] for i in int_list ]