code: def test_reset_nan_reset_inf_forward_backward(
      seed, val, fname, ctx, func_name
  ):
      from nbla_test_utils import function_tester
  
      np_fun = getattr(np, fname.replace("reset_", "is"))
      nn_fun = getattr(F, fname)
      rng = np.random.RandomState(seed)
      inputs = [rng.randn(2, 3, 4).astype(np.float32)]
      inputs[0][rng.rand(*inputs[0].shape) > 0.5] = getattr(
          np, fname.replace("reset_", "")
      )
  
      def ref_forward(x, val):
          y = x.copy()
          y[np_fun(x)] = val
          return y
  
      def ref_backward(x, dy, val, **kw):
          dx = dy.copy()
          dx[np_fun(x)] = 0
          return dx.flatten()
  
      function_tester(
          rng,
          nn_fun,
          ref_forward,
          inputs,
          func_args=[val],
          ref_grad=ref_backward,
          ctx=ctx,
          func_name=func_name,
      )
  
imports: import pytest
  import numpy
  import nnabla.functions
  from nbla_test_utils import list_ctx_and_func_name2
label_desc: Use image node_id 2 for calling a global function with example usage: test_reset_nan_reset_inf_forward_backward(seed, val, fname, ctx, func_name) and returns: y, dx