code: def one_hot(
      data, depth=None, on_value=1.0, off_value=0.0, dtype="float32"
  ):
      r"""Returns a one-hot array.
  
      The locations represented by `indices` take value `on_value`, while all
      other locations take value `off_value`.
  
      `one_hot` operation with `indices` of shape ``(i0, i1)`` and `depth`  of ``d`` would result
      in an output array of shape ``(i0, i1, d)`` with::
  
        output[i,j,:] = off_value
        output[i,j,indices[i,j]] = on_value
  
      Parameters
      ----------
      indices : NDArray
          array of locations where to set on_value
      depth : long, required
          Depth of the one hot dimension.
      on_value : double, optional, default=1
          The value assigned to the locations represented by indices.
      off_value : double, optional, default=0
          The value assigned to the locations not represented by indices.
      dtype : {'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},
              optional, default='float32'
          DType of the output
  
      Returns
      -------
      out : NDArray or list of NDArrays
          The output of this function.
  
      Example
      -------
      >>> data = np.array([1,0,2,0])
      >>> npx.one_hot(data, 3)
      array([[0., 1., 0.],
             [1., 0., 0.],
             [0., 0., 1.],
             [1., 0., 0.]], dtype=float64)
      >>> npx.one_hot(data, 3, on_value=8, off_value=1, dtype='int32')
      array([[1, 8, 1],
             [8, 1, 1],
             [1, 1, 8],
             [8, 1, 1]], dtype=int32)
      >>> data = np.array([[1,0],[1,0],[2,0]])
      >>> npx.one_hot(data, 3)
      array([[[0., 1., 0.],
              [1., 0., 0.]],
             [[0., 1., 0.],
              [1., 0., 0.]],
             [[0., 0., 1.],
              [1., 0., 0.]]], dtype=float64)
      """
      assert (
          depth is not None
      ), "Please provide the depth of one hot dimension."
      if not isinstance(dtype, str):
          dtype = get_dtype_name(dtype)
      return _api_internal.one_hot(
          data, depth, on_value, off_value, dtype
      )
  
imports: import numpy
  from .._internal import NDArrayBase
  from .None import _api_internal
  from ...util import set_module
  from ..ndarray import get_dtype_name
label_desc: Use image node_id 13 for calling a global function with example usage: one_hot(data, depth, on_value, off_value, dtype) and returns: _api_internal