code: def test_forward_backward(
      seed, ishape, k, abs, base_axis, ctx, fname
  ):
      rng = np.random.RandomState(seed)
      inputs = [rng.randn(*ishape).astype(np.float32)]
      grad_unstable = False
      if fname.endswith("Cuda"):
          # TopKGradCuda backward use unstable sort, so the result will change each run.
          grad_unstable = True
  
      function_tester(
          rng,
          F.top_k_grad,
          ref_top_k_grad_fw,
          inputs,
          ctx=ctx,
          func_name=fname,
          ref_grad=ref_top_k_grad_bw,
          func_args=[k, abs, base_axis],
          disable_half_test=k > 10,
          disable_clear_no_need_grad_test=grad_unstable,
          disable_auto_forward_backward_tester=grad_unstable,
      )
  
file_path: nnabla/python/test/function/test_top_k_grad.py
imports: import pytest
  import numpy
  import nnabla.functions
  from nbla_test_utils import list_context, function_tester
label_desc: Use image node_id 4 for calling a global function with example usage: test_forward_backward(seed, ishape, k, abs, base_axis, ctx, fname) without return types