docstr: ivy.Array instance method variant of ivy.cross_entropy. This method
  simply wraps the function, and so the docstring for ivy.cross_entropy
  also applies to this method with minimal changes.
  
  Parameters
  ----------
  self
      input array containing true labels.
  pred
      input array containing the predicted labels.
  axis
      the axis along which to compute the cross-entropy. If axis is ``-1``,
      the cross-entropy will be computed along the last dimension.
      Default: ``-1``.
  epsilon
      a float in [0.0, 1.0] specifying the amount of smoothing when calculating
      the loss. If epsilon is ``0``, no smoothing will be applied.
      Default: ``1e-7``.
  out
      optional output array, for writing the result to. It must have a shape
      that the inputs broadcast to.
  
  Returns
  -------
  ret
      The cross-entropy loss between the given distributions.
  
  Examples
  --------
  >>> x = ivy.array([0, 0, 1, 0])
  >>> y = ivy.array([0.25, 0.25, 0.25, 0.25])
  >>> z = x.cross_entropy(y)
  >>> print(z)
  ivy.array(1.3862944)
docstr_tok: ["ivy.Array","instance","method","variant","of","ivy.cross_entropy",".","This","method","simply","wraps","the","function",",","and","so","the","docstring","for","ivy.cross_entropy","also","applies","to","this","method","with","minimal","changes",".","Parameters","--","--","--","--","--","self","input","array","containing","true","labels",".","pred","input","array","containing","the","predicted","labels",".","axis","the","axis","along","which","to","compute","the","cross-entropy",".","If","axis","is","``","-1","``",",","the","cross-entropy","will","be","computed","along","the","last","dimension",".","Default",":","``","-1","``",".","epsilon","a","float","in","[","0.0",",","1.0","]","specifying","the","amount","of","smoothing","when","calculating","the","loss",".","If","epsilon","is","``","0","``",",","no","smoothing","will","be","applied",".","Default",":","``","1e-7","``",".","out","optional","output","array",",","for","writing","the","result","to",".","It","must","have","a","shape","that","the","inputs","broadcast","to",".","Returns","--","--","--","-","ret","The","cross-entropy","loss","between","the","given","distributions",".","Examples","--","--","--","--",">",">",">","x","=","ivy.array","(","[","0",",","0",",","1",",","0","]",")",">",">",">","y","=","ivy.array","(","[","0.25",",","0.25",",","0.25",",","0.25","]",")",">",">",">","z","=","x.cross_entropy","(","y",")",">",">",">","print","(","z",")","ivy.array","(","1.3862944",")"]
code: def cross_entropy(
      self: ivy.Array,
      pred: Union[ivy.Array, ivy.NativeArray],
      /,
      *,
      axis: int = -1,
      epsilon: float = 1e-7,
      reduction: str = "mean",
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """ivy.Array instance method variant of ivy.cross_entropy. This method
      simply wraps the function, and so the docstring for ivy.cross_entropy
      also applies to this method with minimal changes.
  
      Parameters
      ----------
      self
          input array containing true labels.
      pred
          input array containing the predicted labels.
      axis
          the axis along which to compute the cross-entropy. If axis is ``-1``,
          the cross-entropy will be computed along the last dimension.
          Default: ``-1``.
      epsilon
          a float in [0.0, 1.0] specifying the amount of smoothing when calculating
          the loss. If epsilon is ``0``, no smoothing will be applied.
          Default: ``1e-7``.
      out
          optional output array, for writing the result to. It must have a shape
          that the inputs broadcast to.
  
      Returns
      -------
      ret
          The cross-entropy loss between the given distributions.
  
      Examples
      --------
      >>> x = ivy.array([0, 0, 1, 0])
      >>> y = ivy.array([0.25, 0.25, 0.25, 0.25])
      >>> z = x.cross_entropy(y)
      >>> print(z)
      ivy.array(1.3862944)
      """
      return ivy.cross_entropy(
          self._data,
          pred,
          axis=axis,
          epsilon=epsilon,
          reduction=reduction,
          out=out,
      )
  
file_path: ivy/ivy/data_classes/array/losses.py
imports: import abc
  from typing import Optional, Union
  import ivy
label_desc: Use image node_id 1 for calling the _ArrayWithLosses obj's underlying member method code with example usage: obj.cross_entropy() and returns: ivy