original_docstring: a is 2d with values ranging from 0 to num_labels-1.  this turns a into a 3d matrix with same first two dimensions, one hot encoded
docstring: a is 2d with values ranging from 0 to num_labels-1.  this turns a into a 3d matrix with same first two dimensions, one hot encoded
docstring_tokens: a is 2d with values ranging from 0 to num_labels - 1 . this turns a into a 3d matrix with same first two dimensions one hot encoded
code: def onehot_initialization(a):
      '''a is 2d with values ranging from 0 to num_labels-1.  this turns a into a 3d matrix with same first two dimensions, one hot encoded'''
      ncols = a.max()+1
      out = np.zeros(a.shape + (ncols,), dtype=int)
      out[all_idx(a, axis=2)] = 1
      return out
code_tokens: def onehot_initialization ( a ) : ncols = a . max ( ) + 1 out = np . zeros ( a . shape + ( ncols , ) , dtype = int ) out [ all_idx ( a , axis = 2 ) ] = 1 return out
short_docstring: a is 2d with values ranging from 0 to num_labels-1.
short_docstring_tokens: a is 2d with values ranging from 0 to num_labels - 1 .
comment: '''a is 2d with values ranging from 0 to num_labels-1.  this turns a into a 3d matrix with same first two dimensions, one hot encoded'''