docstr: ivy.Array instance method variant of ivy.one_hot. This method simply
  wraps the function, and so the docstring for ivy.one_hot also applies
  to this method with minimal changes.
  
  Parameters
  ----------
  self
      input array containing the indices for which the ones should be scattered
  depth
      Scalar defining the depth of the one-hot dimension.
  on_value
      Value to fill in output when ``indices[j] == i``. Default 1.
  off_value
      Value to fill in output when ``indices[j] != i``. Default 0.
  axis
      The axis to scatter on. The default is ``-1`` which is the last axis.
  dtype
      The data type of the output array. If None, the data type of the on_value is
      used, or if that is None, the data type of the off_value is used. Default
      float32.
  device
      device on which to create the array 'cuda:0', 'cuda:1', 'cpu' etc.
      Same as x if None.
  out
      optional output array, for writing the result to. It must have a shape
      that the inputs broadcast to.
  
  Returns
  -------
  ret
      Tensor of zeros with the same shape and type as a, unless dtype provided
      which overrides.
  
  Examples
  --------
  With :class:`ivy.Array` inputs:
  
  >>> x = ivy.array([3, 1])
  >>> y = 5
  >>> z = x.one_hot(5)
  >>> print(z)
  ivy.array([[0., 0., 0., 1., 0.],
  ...    [0., 1., 0., 0., 0.]])
  
  >>> x = ivy.array([0])
  >>> y = 5
  >>> ivy.one_hot(x, y)
  ivy.array([[1., 0., 0., 0., 0.]])
  
  >>> x = ivy.array([0])
  >>> y = 5
  >>> ivy.one_hot(x, 5, out=z)
  ivy.array([[1., 0., 0., 0., 0.]])
  >>> print(z)
  ivy.array([[1., 0., 0., 0., 0.]])
docstr_tok: ["ivy.Array","instance","method","variant","of","ivy.one_hot",".","This","method","simply","wraps","the","function",",","and","so","the","docstring","for","ivy.one_hot","also","applies","to","this","method","with","minimal","changes",".","Parameters","--","--","--","--","--","self","input","array","containing","the","indices","for","which","the","ones","should","be","scattered","depth","Scalar","defining","the","depth","of","the","one-hot","dimension",".","on_value","Value","to","fill","in","output","when","``","indices","[","j","]","==","i","``",".","Default","1.","off_value","Value","to","fill","in","output","when","``","indices","[","j","]","!","=","i","``",".","Default","0.","axis","The","axis","to","scatter","on",".","The","default","is","``","-1","``","which","is","the","last","axis",".","dtype","The","data","type","of","the","output","array",".","If","None",",","the","data","type","of","the","on_value","is","used",",","or","if","that","is","None",",","the","data","type","of","the","off_value","is","used",".","Default","float32",".","device","device","on","which","to","create","the","array","'cuda:0","'",",","'cuda:1","'",",","'cpu","'","etc",".","Same","as","x","if","None",".","out","optional","output","array",",","for","writing","the","result","to",".","It","must","have","a","shape","that","the","inputs","broadcast","to",".","Returns","--","--","--","-","ret","Tensor","of","zeros","with","the","same","shape","and","type","as","a",",","unless","dtype","provided","which","overrides",".","Examples","--","--","--","--","With",":","class",":","`","ivy.Array","`","inputs",":",">",">",">","x","=","ivy.array","(","[","3",",","1","]",")",">",">",">","y","=","5",">",">",">","z","=","x.one_hot","(","5",")",">",">",">","print","(","z",")","ivy.array","(","[","[","0.",",","0.",",","0.",",","1.",",","0",".","]",",","...","[","0.",",","1.",",","0.",",","0.",",","0",".","]","]",")",">",">",">","x","=","ivy.array","(","[","0","]",")",">",">",">","y","=","5",">",">",">","ivy.one_hot","(","x",",","y",")","ivy.array","(","[","[","1.",",","0.",",","0.",",","0.",",","0",".","]","]",")",">",">",">","x","=","ivy.array","(","[","0","]",")",">",">",">","y","=","5",">",">",">","ivy.one_hot","(","x",",","5",",","out=z",")","ivy.array","(","[","[","1.",",","0.",",","0.",",","0.",",","0",".","]","]",")",">",">",">","print","(","z",")","ivy.array","(","[","[","1.",",","0.",",","0.",",","0.",",","0",".","]","]",")"]
code: def one_hot(
      self: ivy.Array,
      depth: int,
      /,
      *,
      on_value: Optional[Number] = None,
      off_value: Optional[Number] = None,
      axis: Optional[int] = None,
      dtype: Optional[Union[ivy.Dtype, ivy.NativeDtype]] = None,
      device: Optional[Union[ivy.Device, ivy.NativeDevice]] = None,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """ivy.Array instance method variant of ivy.one_hot. This method simply
      wraps the function, and so the docstring for ivy.one_hot also applies
      to this method with minimal changes.
  
      Parameters
      ----------
      self
          input array containing the indices for which the ones should be scattered
      depth
          Scalar defining the depth of the one-hot dimension.
      on_value
          Value to fill in output when ``indices[j] == i``. Default 1.
      off_value
          Value to fill in output when ``indices[j] != i``. Default 0.
      axis
          The axis to scatter on. The default is ``-1`` which is the last axis.
      dtype
          The data type of the output array. If None, the data type of the on_value is
          used, or if that is None, the data type of the off_value is used. Default
          float32.
      device
          device on which to create the array 'cuda:0', 'cuda:1', 'cpu' etc.
          Same as x if None.
      out
          optional output array, for writing the result to. It must have a shape
          that the inputs broadcast to.
  
      Returns
      -------
      ret
          Tensor of zeros with the same shape and type as a, unless dtype provided
          which overrides.
  
      Examples
      --------
      With :class:`ivy.Array` inputs:
  
      >>> x = ivy.array([3, 1])
      >>> y = 5
      >>> z = x.one_hot(5)
      >>> print(z)
      ivy.array([[0., 0., 0., 1., 0.],
      ...    [0., 1., 0., 0., 0.]])
  
      >>> x = ivy.array([0])
      >>> y = 5
      >>> ivy.one_hot(x, y)
      ivy.array([[1., 0., 0., 0., 0.]])
  
      >>> x = ivy.array([0])
      >>> y = 5
      >>> ivy.one_hot(x, 5, out=z)
      ivy.array([[1., 0., 0., 0., 0.]])
      >>> print(z)
      ivy.array([[1., 0., 0., 0., 0.]])
      """
      return ivy.one_hot(
          self,
          depth,
          on_value=on_value,
          off_value=off_value,
          axis=axis,
          dtype=dtype,
          device=device,
          out=out,
      )
  
file_path: ivy/ivy/data_classes/array/creation.py
imports: import abc
  from numbers import Number
  from typing import Optional, Union, List
  import ivy
label_desc: Use image node_id 12 for calling the _ArrayWithCreation obj's underlying member method code with example usage: obj.one_hot() and returns: ivy