code: def test_multiple_objectives(seed, ctx, auto_forward):
      # 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)
  
      # Objecive0
      x0 = nn.Variable.from_numpy_array(rng.randn(b, c, h, w)).apply(
          need_grad=True
      )
      y0 = F.sigmoid(x0)
      # Objecive1
      x1 = nn.Variable.from_numpy_array(rng.randn(b, c, h, w)).apply(
          need_grad=True
      )
      y1 = F.tanh(x1)
  
      # Zerograd, Forward, Backward on the forward graph
      g0 = nn.NdArray.from_numpy_array(rng.randn(*x0.shape))
      g1 = nn.NdArray.from_numpy_array(rng.randn(*x1.shape))
      z = y0 * nn.Variable(g0.shape).apply(data=g0) + y1 * nn.Variable(
          g1.shape
      ).apply(data=g1)
      inputs = [x0, x1]
      [inp.grad.zero() for inp in inputs]
      if not auto_forward:
          z.forward()
      z.backward()
  
      # Grad
      inputs = [x0, x1]
      outputs = [y0, y1]
      grad_outputs = [g0, g1]
      grads = nn.grad(outputs, inputs, grad_outputs)
      if not auto_forward:
          F.sink(*grads, one_input_grad=1).forward()
  
      # Check between results of var.backward 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 4 for calling a global function with example usage: test_multiple_objectives(seed, ctx, auto_forward) without return types