code: def gradient(
      x: 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
      ----------
      x
          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 'frist 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.current_backend(x).gradient(
          x, spacing=spacing, edge_order=edge_order, axis=axis
      )
  
imports: from typing import Optional, Union, Tuple, List, Sequence
  from numbers import Number
  import ivy
  from ivy.func_wrapper import handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_array_function, infer_dtype, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 18 for calling a global function with example usage: gradient() and returns: ivy