From 8ae27c004c03761a7017d240ba885362d0835d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yan=20Facai=20=28=E9=A2=9C=E5=8F=91=E6=89=8D=29?= Date: Thu, 23 May 2019 16:10:00 +0800 Subject: [PATCH] TST: add unit test --- tensorflow/python/kernel_tests/relu_op_test.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tensorflow/python/kernel_tests/relu_op_test.py b/tensorflow/python/kernel_tests/relu_op_test.py index 2913d5b0a35..bd9726b74c9 100644 --- a/tensorflow/python/kernel_tests/relu_op_test.py +++ b/tensorflow/python/kernel_tests/relu_op_test.py @@ -390,6 +390,22 @@ class LeakyReluTest(test.TestCase): self.evaluate(optimizer.minimize(loss)) self.assertAllClose(x.read_value(), -99.9) + def testUnexpectedAlphaValue(self): + self.assertAllClose( + np.array([[-9.0, 0.7, -5.0, 0.3, -0.1], + [0.1, -3.0, 0.5, -27.0, 0.9]]), + nn_ops.leaky_relu( + np.array([[-0.9, 0.7, -0.5, 0.3, -0.01], + [0.1, -0.3, 0.5, -2.7, 0.9]]), + alpha=10)) + self.assertAllClose( + np.array([[9.0, 0.7, 5.0, 0.3, 0.1], + [0.1, 3.0, 0.5, 27.0, 0.9]]), + nn_ops.leaky_relu( + np.array([[-0.9, 0.7, -0.5, 0.3, -0.01], + [0.1, -0.3, 0.5, -2.7, 0.9]]), + alpha=-10)) + class EluTest(test.TestCase):