docstr: Calculate gradient of x with respect to (w.r.t.) spacing.
  
  Parameters
  ----------
  self
      input array representing outcomes of the function
  spacing
      if not given, indices of x will be used
      if scalar indices of x will be scaled with this value
      if array gradient of x w.r.t. spacing
  edge_order
      1 or 2, for 'first order' and 'second order' estimation
      of boundary values of gradient respectively.
      Note: jax supports edge_order=1 case only
  axis
      dimension(s) to approximate the gradient over
      by default partial gradient is computed in every dimension
  
  
  Returns
  -------
  ret
      Array with values computed from gradient function from
      inputs
  
  Examples
  --------
  >>> spacing = (ivy.array([-2., -1., 1., 4.]),)
  >>> x = ivy.array([4., 1., 1., 16.], )
  >>> ivy.gradient(x, spacing=spacing)
  ivy.array([-3., -2.,  2.,  5.])
  
  >>> x = ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]])
  >>> ivy.gradient(x)
  [ivy.array([[ 9., 18., 36., 72.],
     [ 9., 18., 36., 72.]]), ivy.array([[ 1. ,  1.5,  3. ,  4. ],
     [10. , 15. , 30. , 40. ]])]
  
  >>> x = ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]])
  >>> ivy.gradient(x, spacing=2.0)
  [ivy.array([[ 4.5,  9. , 18. , 36. ],
     [ 4.5,  9. , 18. , 36. ]]), ivy.array([[ 0.5 ,  0.75,  1.5 ,  2.  ],
     [ 5.  ,  7.5 , 15.  , 20.  ]])]
  
  >>> x = ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]])
  >>> ivy.gradient(x, axis=1)
  ivy.array([[ 1. ,  1.5,  3. ,  4. ],
     [10. , 15. , 30. , 40. ]])
  
  >>> x = ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]])
  >>> ivy.gradient(x, spacing=[3., 2.])
  [ivy.array([[ 3.,  6., 12., 24.],
     [ 3.,  6., 12., 24.]]), ivy.array([[ 0.5 ,  0.75,  1.5 ,  2.  ],
     [ 5.  ,  7.5 , 15.  , 20.  ]])]
  
  >>> spacing = (ivy.array([0, 2]), ivy.array([0, 3, 6, 9]))
  >>> ivy.gradient(x, spacing=spacing)
  [ivy.array([[ 4.5,  9. , 18. , 36. ],
     [ 4.5,  9. , 18. , 36. ]]), ivy.array([[ 0.33333333,  0.5,  1., 1.33333333],
     [ 3.33333333,  5.        , 10.        , 13.33333333]])]
docstr_tok: ["Calculate","gradient","of","x","with","respect","to","(","w.r.t",".",")","spacing",".","Parameters","--","--","--","--","--","self","input","array","representing","outcomes","of","the","function","spacing","if","not","given",",","indices","of","x","will","be","used","if","scalar","indices","of","x","will","be","scaled","with","this","value","if","array","gradient","of","x","w.r.t",".","spacing","edge_order","1","or","2",",","for","'first","order","'","and","'second","order","'","estimation","of","boundary","values","of","gradient","respectively",".","Note",":","jax","supports","edge_order=1","case","only","axis","dimension","(","s",")","to","approximate","the","gradient","over","by","default","partial","gradient","is","computed","in","every","dimension","Returns","--","--","--","-","ret","Array","with","values","computed","from","gradient","function","from","inputs","Examples","--","--","--","--",">",">",">","spacing","=","(","ivy.array","(","[","-2.",",","-1.",",","1.",",","4",".","]",")",",",")",">",">",">","x","=","ivy.array","(","[","4.",",","1.",",","1.",",","16",".","]",",",")",">",">",">","ivy.gradient","(","x",",","spacing=spacing",")","ivy.array","(","[","-3.",",","-2.",",","2.",",","5",".","]",")",">",">",">","x","=","ivy.array","(","[","[","1",",","2",",","4",",","8","]",",","[","10",",","20",",","40",",","80","]","]",")",">",">",">","ivy.gradient","(","x",")","[","ivy.array","(","[","[","9.",",","18.",",","36.",",","72",".","]",",","[","9.",",","18.",",","36.",",","72",".","]","]",")",",","ivy.array","(","[","[","1.",",","1.5",",","3.",",","4",".","]",",","[","10.",",","15.",",","30.",",","40",".","]","]",")","]",">",">",">","x","=","ivy.array","(","[","[","1",",","2",",","4",",","8","]",",","[","10",",","20",",","40",",","80","]","]",")",">",">",">","ivy.gradient","(","x",",","spacing=2.0",")","[","ivy.array","(","[","[","4.5",",","9.",",","18.",",","36",".","]",",","[","4.5",",","9.",",","18.",",","36",".","]","]",")",",","ivy.array","(","[","[","0.5",",","0.75",",","1.5",",","2",".","]",",","[","5.",",","7.5",",","15.",",","20",".","]","]",")","]",">",">",">","x","=","ivy.array","(","[","[","1",",","2",",","4",",","8","]",",","[","10",",","20",",","40",",","80","]","]",")",">",">",">","ivy.gradient","(","x",",","axis=1",")","ivy.array","(","[","[","1.",",","1.5",",","3.",",","4",".","]",",","[","10.",",","15.",",","30.",",","40",".","]","]",")",">",">",">","x","=","ivy.array","(","[","[","1",",","2",",","4",",","8","]",",","[","10",",","20",",","40",",","80","]","]",")",">",">",">","ivy.gradient","(","x",",","spacing=","[","3.",",","2",".","]",")","[","ivy.array","(","[","[","3.",",","6.",",","12.",",","24",".","]",",","[","3.",",","6.",",","12.",",","24",".","]","]",")",",","ivy.array","(","[","[","0.5",",","0.75",",","1.5",",","2",".","]",",","[","5.",",","7.5",",","15.",",","20",".","]","]",")","]",">",">",">","spacing","=","(","ivy.array","(","[","0",",","2","]",")",",","ivy.array","(","[","0",",","3",",","6",",","9","]",")",")",">",">",">","ivy.gradient","(","x",",","spacing=spacing",")","[","ivy.array","(","[","[","4.5",",","9.",",","18.",",","36",".","]",",","[","4.5",",","9.",",","18.",",","36",".","]","]",")",",","ivy.array","(","[","[","0.33333333",",","0.5",",","1.",",","1.33333333","]",",","[","3.33333333",",","5.",",","10.",",","13.33333333","]","]",")","]"]
code: def gradient(
      self: Union[ivy.Array, ivy.NativeArray],
      /,
      *,
      spacing: Union[int, list, tuple] = 1,
      edge_order: int = 1,
      axis: Optional[Union[int, list, tuple]] = None,
  ) -> Union[ivy.Array, List[ivy.Array]]:
      """Calculate gradient of x with respect to (w.r.t.) spacing.
  
      Parameters
      ----------
      self
          input array representing outcomes of the function
      spacing
          if not given, indices of x will be used
          if scalar indices of x will be scaled with this value
          if array gradient of x w.r.t. spacing
      edge_order
          1 or 2, for 'first order' and 'second order' estimation
          of boundary values of gradient respectively.
          Note: jax supports edge_order=1 case only
      axis
          dimension(s) to approximate the gradient over
          by default partial gradient is computed in every dimension
  
  
      Returns
      -------
      ret
          Array with values computed from gradient function from
          inputs
  
      Examples
      --------
      >>> spacing = (ivy.array([-2., -1., 1., 4.]),)
      >>> x = ivy.array([4., 1., 1., 16.], )
      >>> ivy.gradient(x, spacing=spacing)
      ivy.array([-3., -2.,  2.,  5.])
  
      >>> x = ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]])
      >>> ivy.gradient(x)
      [ivy.array([[ 9., 18., 36., 72.],
         [ 9., 18., 36., 72.]]), ivy.array([[ 1. ,  1.5,  3. ,  4. ],
         [10. , 15. , 30. , 40. ]])]
  
      >>> x = ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]])
      >>> ivy.gradient(x, spacing=2.0)
      [ivy.array([[ 4.5,  9. , 18. , 36. ],
         [ 4.5,  9. , 18. , 36. ]]), ivy.array([[ 0.5 ,  0.75,  1.5 ,  2.  ],
         [ 5.  ,  7.5 , 15.  , 20.  ]])]
  
      >>> x = ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]])
      >>> ivy.gradient(x, axis=1)
      ivy.array([[ 1. ,  1.5,  3. ,  4. ],
         [10. , 15. , 30. , 40. ]])
  
      >>> x = ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]])
      >>> ivy.gradient(x, spacing=[3., 2.])
      [ivy.array([[ 3.,  6., 12., 24.],
         [ 3.,  6., 12., 24.]]), ivy.array([[ 0.5 ,  0.75,  1.5 ,  2.  ],
         [ 5.  ,  7.5 , 15.  , 20.  ]])]
  
      >>> spacing = (ivy.array([0, 2]), ivy.array([0, 3, 6, 9]))
      >>> ivy.gradient(x, spacing=spacing)
      [ivy.array([[ 4.5,  9. , 18. , 36. ],
         [ 4.5,  9. , 18. , 36. ]]), ivy.array([[ 0.33333333,  0.5,  1., 1.33333333],
         [ 3.33333333,  5.        , 10.        , 13.33333333]])]
      """
      return ivy.gradient(
          self._data, spacing=spacing, axis=axis, edge_order=edge_order
      )
  
imports: import abc
  from typing import Optional, Union, Tuple, List, Sequence
  from numbers import Number
  import ivy
label_desc: Use image node_id 19 for calling the _ArrayWithElementWiseExperimental obj's underlying member method code with example usage: obj.gradient() and returns: ivy