code: def test_mul(n_inputs, n_active, input_shape, seed):
      from nnabla.testing import assert_allclose
  
      rng = np.random.RandomState(seed)
      inputs = [
          rng.randn(*input_shape).astype("f4") for _ in range(n_inputs)
      ]
      active = np.random.permutation(n_inputs) < n_active
  
      y = F.mul_n(
          *[
              nn.Variable.from_numpy_array(inp).apply(need_grad=True)
              for inp in inputs
          ]
      )
      y.parent.set_active_input_mask(active)
      y_ref = F.mul_n(
          *[
              nn.Variable.from_numpy_array(inp).apply(need_grad=True)
              for (act, inp) in zip(active, inputs)
              if act
          ]
      )
  
      y.forward()
      y_ref.forward()
      assert_allclose(y.d, y_ref.d)
  
      for inp in y.parent.inputs + y_ref.parent.inputs:
          inp.g = 0
  
      y.backward()
      y_ref.backward()
      active_inputs = [
          y.parent.inputs[i] for i, act in enumerate(active) if act
      ]
      for inp, ref in zip(active_inputs, y_ref.parent.inputs):
          assert_allclose(inp.g, ref.g)
  
file_path: nnabla/python/test/function/test_mul_n.py
imports: import pytest
  import numpy
  import nnabla
  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_mul(n_inputs, n_active, input_shape, seed) without return types