code: def test_nonzero_forward(seed, inshape, zero_rate, ctx, func_name):
      rng = np.random.RandomState(seed)
      input = rng.randn(*inshape).astype(dtype=np.float32)
      cond = rng.rand(*inshape) <= zero_rate
      input = np.where(cond, np.zeros_like(input), input)
  
      vinput = nn.Variable.from_numpy_array(input)
      with nn.context_scope(ctx), nn.auto_forward():
          o = F.nonzero(vinput)
      r = ref_nonzero(input)
      assert_allclose(o.d, r)
      assert func_name == o.parent.name
  
file_path: nnabla/python/test/function/test_nonzero.py
imports: import pytest
  import numpy
  import nnabla
  import nnabla.functions
  from nbla_test_utils import list_context
  from nnabla.testing import assert_allclose
label_desc: Use image node_id 2 for calling a global function with example usage: test_nonzero_forward(seed, inshape, zero_rate, ctx, func_name) without return types