code: def test_clip_by_norm_forward(
      seed, shape, clip_norm_type, clip_norm_value, x_value, axis
  ):
      def execute_clip_by_norm(
          x, x_data, clip_norm, clip_norm_value, axis
      ):
          if isinstance(clip_norm, (nn.Variable, nn.NdArray)):
              if clip_norm_value <= 0:
                  pytest.skip()
              else:
                  with nn.auto_forward(True):
                      y = F.clip_by_norm(x, clip_norm, axis)
                  y_ref = ref_clip_by_norm(
                      x_data, clip_norm_value, axis=axis
                  )
                  assert_allclose(y.d, y_ref)
          else:
              if clip_norm_value > 0:
                  with nn.auto_forward(True):
                      y = F.clip_by_norm(x, clip_norm, axis)
                  y_ref = ref_clip_by_norm(
                      x_data, clip_norm_value, axis=axis
                  )
                  assert_allclose(y.d, y_ref)
              else:
                  with pytest.raises(ValueError):
                      y = F.clip_by_norm(x, clip_norm, axis)
  
      rng = np.random.RandomState(seed)
      x_data = rng.randn(*shape)
      x = nn.Variable.from_numpy_array(x_data)
  
      if clip_norm_type == "float":
          clip_norm = clip_norm_value
      elif clip_norm_type == "int":
          clip_norm_value = int(clip_norm_value)
          clip_norm = clip_norm_value
      else:
          clip_norm = nn.Variable(x.ndim * (1,))
          clip_norm.d = clip_norm_value
  
      if x_value == "all_zero":
          x.d = 0
          x_data = np.zeros(x.shape)
  
      execute_clip_by_norm(x, x_data, clip_norm, clip_norm_value, axis)
  
file_path: nnabla/python/test/function/test_clip_by_norm.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_clip_by_norm_forward(seed, shape, clip_norm_type, clip_norm_value, x_value, axis) without return types