code: def one_hot(mat: np.ndarray, num_classes: int) -> np.ndarray:
      """
      Convert a 1D matrix of ints into one-hot encoded vectors.
  
      Arguments:
          mat (numpy.ndarray): A 1D matrix of labels (int)
          num_classes (int): Number of all possible classes
  
      Returns:
          numpy.ndarray: A 2D matrix
      """
      assert len(mat.shape) < 2 or isinstance(mat.shape, int)
      vec = np.zeros((mat.shape[0], num_classes))
      for i, v in enumerate(mat):
          vec[i][v] = 1.0
      return vec
  
file_path: nlp-architect/nlp_architect/utils/generic.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import re
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: one_hot(mat, num_classes) and returns: vec