code: def test_grad(x, dtype, func, backend_fw, nth):
      # ToDo: Remove skipping for paddle and jax for nth > 1
      if backend_fw == "numpy" or (
          backend_fw in ["paddle", "jax"] and nth > 1
      ):
          return
  
      with BackendHandler.update_backend(backend_fw) as ivy_backend:
          _variable_fn = (
              ivy_backend.ivy.functional.ivy.gradients._variable
          )
          var = _variable_fn(ivy_backend.array(x, dtype=dtype))
          fn = ivy_backend.grad(func)
          if nth > 1:
              for _ in range(1, nth):
                  fn = ivy_backend.grad(fn)
          grad = fn(var)
          grad_np = helpers.flatten_and_to_np(
              ret=grad, backend=backend_fw
          )
  
      with BackendHandler.update_backend("tensorflow") as gt_backend:
          _variable_fn = (
              gt_backend.ivy.functional.ivy.gradients._variable
          )
          var = _variable_fn(ivy.array(x, dtype=dtype))
          fn = gt_backend.grad(func)
          if nth > 1:
              for _ in range(1, nth):
                  fn = gt_backend.grad(fn)
  
          grad_gt = fn(var)
          grad_np_from_gt = helpers.flatten_and_to_np(
              ret=grad_gt, backend="tensorflow"
          )
  
      for grad, grad_from_gt in zip(grad_np, grad_np_from_gt):
          assert grad.shape == grad_from_gt.shape
          assert np.allclose(grad, grad_from_gt)
  
file_path: ivy/ivy_tests/test_ivy/test_functional/test_core/test_gradients.py
imports: from hypothesis import strategies
  import pytest
  import numpy
  import ivy
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_test, BackendHandler
label_desc: Use image node_id 5 for calling a global function with example usage: test_grad(x, dtype, func, backend_fw, nth) without return types