code: def _one_hot(  # pylint: disable=unused-argument
      indices,
      depth,
      on_value=None,
      off_value=None,
      axis=None,
      dtype=None,
      name=None,
  ):
      """One hot."""
      if on_value is None:
          on_value = 1
      if off_value is None:
          off_value = 0
      if dtype is None:
          dtype = utils.common_dtype([on_value, off_value], np.float32)
      else:
          dtype = utils.numpy_dtype(dtype)
      indices = np.array(indices)
      pred = (
          abs(
              np.arange(depth, dtype=indices.dtype)
              - indices[..., np.newaxis]
          )
          > 0
      )
      y_out = np.where(
          pred, np.array(off_value, dtype), np.array(on_value, dtype)
      )
      if axis is not None:
          y_out = np.moveaxis(y_out, -1, axis)
      return y_out
  
imports: import functools
  import numpy
  import numpy
  from tensorflow_probability.python.internal.backend.numpy import _utils
  from tensorflow_probability.python.internal.backend.numpy import ops
  from tensorflow_probability.python.internal.backend.numpy.linalg_impl import einsum
  from tensorflow_probability.python.internal.backend.numpy.linalg_impl import norm
  from tensorflow_probability.python.internal.backend.numpy.linalg_impl import tensordot
label_desc: Use image node_id 8 for calling a global function with example usage: _one_hot(indices, depth, on_value, off_value, axis, dtype, name) and returns: y_out