code: def test_grad_outputs(seed, ctx, auto_forward, type_grad_outputs):
      # Settings
      nn.set_default_context(ctx)
      nn.set_auto_forward(auto_forward)
      b, c, h, w = 4, 3, 32, 32
      n_cls = 10
      rng = np.random.RandomState(seed)
  
      x = nn.Variable.from_numpy_array(rng.randn(b, c, h, w)).apply(
          need_grad=True
      )
      y = F.sigmoid(x)
  
      # Grad outputs
      if type_grad_outputs == int:
          g = rng.randint(-10, 10)
      elif type_grad_outputs == float:
          g = rng.randn()
      elif type_grad_outputs == np.ndarray:
          g = rng.randn(*y.shape)
      elif type_grad_outputs == nn.NdArray:
          g = nn.NdArray.from_numpy_array(rng.randn(*y.shape))
  
      # Zerograd, Forward, Backward on the forward graph
      inputs = [x]
      [inp.grad.zero() for inp in inputs]
      if not auto_forward:
          y.forward()
      y.backward(g)
  
      # Grad
      inputs = [x]
      outputs = [y]
      grad_outputs = [g]
      grads = nn.grad(outputs, inputs, grad_outputs)
      if not auto_forward:
          F.sink(*grads, one_input_grad=1).forward()
  
      # Check between results of var.bacwkard and nn.grad
      for inp, grad in zip(inputs, grads):
          assert_allclose(inp.g, grad.d, atol=1e-6)
  
imports: import sys
  import pytest
  import numpy
  import nnabla
  import nnabla.functions
  import nnabla.parametric_functions
  import nnabla.initializer
  from nnabla.ext_utils import get_extension_context
  from nbla_test_utils import list_context
  from nnabla.testing import assert_allclose
  from nnabla.function import PythonFunction
  from nnabla.backward_functions import registry, register
label_desc: Use image node_id 5 for calling a global function with example usage: test_grad_outputs(seed, ctx, auto_forward, type_grad_outputs) without return types