aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/kernel_tests/reduction_ops_test.py
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <nobody@tensorflow.org>2016-01-05 14:05:27 -0800
committerGravatar Vijay Vasudevan <vrv@google.com>2016-01-05 14:05:27 -0800
commit1c579361cd1e088dd5e05a394b1561a73e3667ba (patch)
treeec464b9ac18113dc052744b6714eebbc7c6cc34d /tensorflow/python/kernel_tests/reduction_ops_test.py
parent208350a6092f9faa473daf8b6eb6a80e9f9518f1 (diff)
Added 'logging' import to control_flow_ops which is used in the file but not imported.
Change: 110842260
Diffstat (limited to 'tensorflow/python/kernel_tests/reduction_ops_test.py')
-rw-r--r--tensorflow/python/kernel_tests/reduction_ops_test.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tensorflow/python/kernel_tests/reduction_ops_test.py b/tensorflow/python/kernel_tests/reduction_ops_test.py
index 7ff3851da7..3b79ae341b 100644
--- a/tensorflow/python/kernel_tests/reduction_ops_test.py
+++ b/tensorflow/python/kernel_tests/reduction_ops_test.py
@@ -174,6 +174,28 @@ class SumReductionTest(tf.test.TestCase):
def testGradient4(self):
self._compareGradient([2, 3, 4, 2], [], None)
+ def testHighRank(self):
+ # Do a bunch of random high dimensional reductions
+ np.random.seed(42)
+ for _ in range(20):
+ rank = np.random.randint(4, 10 + 1)
+ axes, = np.nonzero(np.random.randint(2, size=rank))
+ shape = tuple(np.random.randint(1, 3 + 1, size=rank))
+ data = np.random.randint(1024, size=shape)
+ self._compareAll(data, axes)
+ # Check some particular axis patterns
+ for rank in 4, 7, 10:
+ shape = tuple(np.random.randint(1, 3 + 1, size=rank))
+ data = np.random.randint(1024, size=shape)
+ for axes in ([], np.arange(rank), np.arange(0, rank, 2),
+ np.arange(1, rank, 2)):
+ self._compareAll(data, axes)
+
+ def testExpand(self):
+ # Reduce an empty tensor to a nonempty tensor
+ x = np.zeros((5, 0))
+ self._compareAll(x, [1])
+
class MeanReductionTest(tf.test.TestCase):