code: def test_parametric_function_api():
      """
      Testing :function:`nnabla.parametric_functions.parametric_function_api`.
      """
      import nnabla as nn
      import inspect
  
      nn.clear_parameters()
      shape = (2, 3, 4)
  
      # Signature check
      empty = inspect.Parameter.empty
      sig = inspect.Signature.from_callable(dummy_parametric_function)
      ref_name = ("shape", "f", "i", "s", "fix_parameters", "name")
      ref_default = (empty, 10, 1, "dummy", False, None)
      for param, rname, rdefault in zip(
          sig.parameters.values(), ref_name, ref_default
      ):
          assert param.name == rname
          assert param.default == rdefault
      assert dummy_parametric_function.__doc__.splitlines()[0] == "Doc"
  
      # Verify two different ways does the same thing.
      # Using name argument
      v = dummy_parametric_function(shape, name="group1")
      # Using parameter_scope
      with nn.parameter_scope("group1"):
          v = dummy_parametric_function(shape)
  
      params = nn.get_parameters()
      assert len(params) == 2
      assert list(iterkeys(params)) == [
          "group1/dummy/p1",
          "group1/dummy/p2",
      ]
  
      # No scope
      v = dummy_parametric_function(shape)
  
      params = nn.get_parameters()
      len(params) == 4
      assert list(iterkeys(params)) == [
          "group1/dummy/p1",
          "group1/dummy/p2",
          "dummy/p1",
          "dummy/p2",
      ]
      nn.clear_parameters()
  
file_path: nnabla/python/test/test_parameter.py
imports: from six import iterkeys
  import pytest
  import numpy
  import nnabla.parametric_functions
  from nnabla.initializer import UniformInitializer
label_desc: Use image node_id 6 for calling a global function with example usage: test_parametric_function_api() without return types