code: def test_gradient_backend_computation(
      backend_to_test,
      args_np,
      arg_np_vals,
      args_idxs,
      kwargs_np,
      kwarg_np_vals,
      kwargs_idxs,
      input_dtypes,
      test_flags,
      on_device,
      fn,
      test_trace,
      xs_grad_idxs,
      ret_grad_idxs,
  ):
      args, kwargs = create_args_kwargs(
          backend=backend_to_test,
          args_np=args_np,
          arg_np_vals=arg_np_vals,
          args_idxs=args_idxs,
          kwargs_np=kwargs_np,
          kwarg_np_vals=kwarg_np_vals,
          kwargs_idxs=kwargs_idxs,
          input_dtypes=input_dtypes,
          test_flags=test_flags,
          on_device=on_device,
      )
  
      with BackendHandler.update_backend(
          backend_to_test
      ) as ivy_backend:
  
          def _grad_fn(all_args):
              args, kwargs, i = all_args
              call_fn = (
                  ivy_backend.__dict__[fn]
                  if isinstance(fn, str)
                  else fn[i]
              )
              ret = traced_if_required(
                  backend_to_test,
                  call_fn,
                  test_trace=test_trace,
                  args=args,
                  kwargs=kwargs,
              )(*args, **kwargs)
              return ivy_backend.nested_map(
                  ivy_backend.mean, ret, include_derived=True
              )
  
          with ivy_backend.PreciseMode(test_flags.precision_mode):
              _, grads = ivy_backend.execute_with_gradients(
                  _grad_fn,
                  [args, kwargs, 0],
                  xs_grad_idxs=xs_grad_idxs,
                  ret_grad_idxs=ret_grad_idxs,
              )
      grads_np_flat = flatten_and_to_np(
          backend=backend_to_test, ret=grads
      )
      return grads_np_flat
  
imports: import copy
  import time
  from typing import Union, List, Optional
  import numpy
  import types
  import importlib
  import inspect
  from collections import OrderedDict
  from .globals import mod_backend
  from .pipeline_helper import BackendHandler, BackendHandlerMode, get_frontend_config
  import ivy
  from ivy_tests.test_ivy.helpers.test_parameter_flags import FunctionTestFlags
  import ivy_tests.test_ivy.helpers.test_parameter_flags
  import ivy_tests.test_ivy.helpers.globals
  from ivy.functional.ivy.data_type import _get_function_list, _get_functions_from_string
  from ivy_tests.test_ivy.test_frontends import NativeClass
  from ivy_tests.test_ivy.helpers.structs import FrontendMethodData
  from ivy_tests.test_ivy.helpers.testing_helpers import _create_transpile_report
  from .assertions import value_test, assert_same_type, check_unsupported_dtype
label_desc: Use image node_id 10 for calling a global function with example usage: test_gradient_backend_computation(backend_to_test, args_np, arg_np_vals, args_idxs, kwargs_np, kwarg_np_vals, kwargs_idxs, input_dtypes, test_flags, on_device, fn, test_trace, xs_grad_idxs, ret_grad_idxs) and returns: grads_np_flat, ivy_backend