code: def tokens_to_one_hot(tokens, one_hot_dim):
      """
      Converts an L-vector of integers in the range [0, D] to an L x D one-hot
      encoding. The value `D` must be provided as `one_hot_dim`. A token of D
      means the one-hot encoding is all 0s.
      """
      identity = np.identity(one_hot_dim + 1)[
          :, :-1
      ]  # Last row is all 0s
      return identity[tokens]
  
imports: from __future__ import division, print_function
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: tokens_to_one_hot(tokens, one_hot_dim) and returns: identity