code: def test_clip_by_value_forward(seed, shape, dtype):
      def convert(value):
          converter = (
              dtype
              if dtype in (float, np.array)
              else dtype.from_numpy_array
          )
          return converter(value)
  
      rng = np.random.RandomState(seed)
      x_data = rng.randn(*shape)
      x = nn.Variable.from_numpy_array(x_data)
      if dtype is float:
          min_data = rng.randn()
          max_data = rng.randn()
      else:
          min_data = rng.randn(*shape)
          max_data = rng.randn(*shape)
      min_ = convert(min_data)
      max_ = convert(max_data)
  
      if dtype is not np.array:
          with nn.auto_forward(True):
              y = F.clip_by_value(x, min_, max_)
          y_ref = ref_clip_by_value(x_data, min_data, max_data)
  
          if dtype in (nn.Variable, float):
              assert_allclose(y.d, y_ref)
          elif dtype is nn.NdArray:
              assert_allclose(y.data, y_ref)
      else:
          with pytest.raises(TypeError):
              y = F.clip_by_value(x, min_data, max_data)
  
file_path: nnabla/python/test/function/test_clip_by_value.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_value_forward(seed, shape, dtype) and returns: converter