code: def constrain(self, v, min_val, max_val):
      def constrain_internal(x):
          return min(max(x, min_val), max_val)
  
      return np.array([constrain_internal(x) for x in v])
  
file_path: pytorch/caffe2/python/operator_test/piecewise_linear_transform_test.py
imports: from caffe2.python import core
  import caffe2.python.hypothesis_test_util
  import caffe2.python.serialized_test.serialized_test_util
  from hypothesis import given, settings
  import hypothesis.strategies
  import numpy
  import unittest
label_desc: Use image node_id 1 for calling the TestPiecewiseLinearTransform obj's underlying member method code with example usage: obj.constrain(v, min_val, max_val) and returns: np, min