(indices, depth, dtype=np.bool)
return onehot_seq
Converts 1D array of indices to a one-hot 2D array with given depth.
Converts 1D array of indices to a one-hot 2D array with given depth.
Converts 1D array of indices to a one - hot 2D array with given depth .
def np_onehot(indices, depth, dtype=np.bool):
  """Converts 1D array of indices to a one-hot 2D array with given depth."""
  onehot_seq = np.zeros((len(indices), depth), dtype=dtype)
  onehot_seq[np.arange(len(indices)), indices] = 1.0
  return onehot_seq
def np_onehot ( indices , depth , dtype = np . bool ) : onehot_seq = np . zeros ( ( len ( indices ) , depth ) , dtype = dtype ) onehot_seq [ np . arange ( len ( indices ) ) , indices ] = 1.0 return onehot_seq