def testMax(self):
        shape = [100]
        inputs = tf.random_normal(shape)
        clamp = preprocess.Clamp(max_value=0.0)
        output = clamp(inputs)

        with self.test_session() as sess:
            output_np = sess.run(output)
            self.assertTrue(np.all(np.less_equal(output_np, np.zeros(shape))))
    def testMinAndMax(self):
        shape = [100]
        inputs = tf.random_normal(shape)
        clamp = preprocess.Clamp(min_value=0.0, max_value=0.0)
        output = clamp(inputs)

        with self.test_session() as sess:
            output_np = sess.run(output)
            self.assertAllEqual(output_np, np.zeros(shape))
 def testShape(self):
     shape = [2, 3]
     inputs = tf.random_normal(shape)
     clamp = preprocess.Clamp(min_value=-1.0, max_value=1.0)
     output = clamp(inputs)
     self.assertEqual(output.get_shape().as_list(), shape)