original_docstring: 
      Converts label image `labels' to a one-hot vector with `num_classes' number of channels as last dimension.
      
docstring: Converts label image `labels' to a one-hot vector with `num_classes' number of channels as last dimension.
docstring_tokens: Converts label image ` labels ' to a one - hot vector with ` num_classes ' number of channels as last dimension .
code: def one_hot(labels, num_classes):
      """
      Converts label image `labels' to a one-hot vector with `num_classes' number of channels as last dimension.
      """
      labels = labels % num_classes
      y = np.eye(num_classes)
      onehot = y[labels.flatten()]
  
      return onehot.reshape(tuple(labels.shape) + (num_classes,)).astype(labels.dtype)
code_tokens: def one_hot ( labels , num_classes ) : labels = labels % num_classes y = np . eye ( num_classes ) onehot = y [ labels . flatten ( ) ] return onehot . reshape ( tuple ( labels . shape ) + ( num_classes , ) ) . astype ( labels . dtype )
short_docstring: Converts label image `labels' to a one-hot vector with `num_classes' number of channels as last dimension.
short_docstring_tokens: Converts label image ` labels ' to a one - hot vector with ` num_classes ' number of channels as last dimension .
comment: """
      Converts label image `labels' to a one-hot vector with `num_classes' number of channels as last dimension.
      """