diff options
Diffstat (limited to 'tensorflow/python/kernel_tests/reduction_ops_test.py')
-rw-r--r-- | tensorflow/python/kernel_tests/reduction_ops_test.py | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/tensorflow/python/kernel_tests/reduction_ops_test.py b/tensorflow/python/kernel_tests/reduction_ops_test.py index 0a55afb3ad..323bc43920 100644 --- a/tensorflow/python/kernel_tests/reduction_ops_test.py +++ b/tensorflow/python/kernel_tests/reduction_ops_test.py @@ -116,8 +116,8 @@ class SumReductionTest(tf.test.TestCase): # Simple tests for various types. def testDoubleReduce1D(self): np_arr = np.arange(1, 6).reshape([5]).astype(np.float64) - self._compare(np_arr, [], False) - self._compare(np_arr, [0], False) + self._compareAll(np_arr, []) + self._compareAll(np_arr, [0]) def testInt32Reduce1D(self): np_arr = np.arange(1, 6).reshape([5]).astype(np.int32) @@ -230,6 +230,19 @@ class MeanReductionTest(tf.test.TestCase): self._compareAll(np_arr, [0, 2]) self._compareAll(np_arr, [0, 1, 2]) + def testDoubleReduce3D(self): + # Create a 3D array of doubles and reduce across all possible + # dimensions + np_arr = np.arange(0, 30).reshape([2, 3, 5]).astype(np.float64) + self._compareAll(np_arr, []) + self._compareAll(np_arr, [0]) + self._compareAll(np_arr, [1]) + self._compareAll(np_arr, [2]) + self._compareAll(np_arr, [0, 1]) + self._compareAll(np_arr, [1, 2]) + self._compareAll(np_arr, [0, 2]) + self._compareAll(np_arr, [0, 1, 2]) + def testGradient(self): s = [2, 3, 4, 2] x = np.arange(1.0, 49.0).reshape(s).astype(np.float32) @@ -383,6 +396,19 @@ class MinReductionTest(tf.test.TestCase): self._compareAll(np_arr, [0, 2]) self._compareAll(np_arr, [0, 1, 2]) + def testDoubleReduce3D(self): + # Create a 3D array of doubles and reduce across all possible + # dimensions + np_arr = np.arange(0, 30).reshape([2, 3, 5]).astype(np.float64) + self._compareAll(np_arr, []) + self._compareAll(np_arr, [0]) + self._compareAll(np_arr, [1]) + self._compareAll(np_arr, [2]) + self._compareAll(np_arr, [0, 1]) + self._compareAll(np_arr, [1, 2]) + self._compareAll(np_arr, [0, 2]) + self._compareAll(np_arr, [0, 1, 2]) + def testGradient(self): s = [2, 3, 4, 2] x = np.arange(1.0, 49.0).reshape(s).astype(np.float64) @@ -477,6 +503,20 @@ class MaxReductionTest(tf.test.TestCase): self._compareAll(np_arr, [0, 2]) self._compareAll(np_arr, [0, 1, 2]) + def testDoubleReduce3D(self): + # Create a 3D array of doubles and reduce across all possible + # dimensions + np_arr = np.arange(0, 30).reshape([2, 3, 5]).astype(np.float64) + self._compareAll(np_arr, None) + self._compareAll(np_arr, []) + self._compareAll(np_arr, [0]) + self._compareAll(np_arr, [1]) + self._compareAll(np_arr, [2]) + self._compareAll(np_arr, [0, 1]) + self._compareAll(np_arr, [1, 2]) + self._compareAll(np_arr, [0, 2]) + self._compareAll(np_arr, [0, 1, 2]) + def testGradient(self): s = [2, 3, 4, 2] x = np.arange(1.0, 49.0).reshape(s).astype(np.float64) |