aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/kernel_tests/pooling_ops_test.py
diff options
context:
space:
mode:
authorGravatar Geoffrey Irving <geoffreyi@google.com>2016-03-22 13:56:31 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-03-22 15:25:05 -0700
commit0663ed111abce98a22d8311a122313df11acde68 (patch)
treee7e07c789930fbf60998458c9f98c0e2d6f79d1b /tensorflow/python/kernel_tests/pooling_ops_test.py
parent12533dd96379c23a9a1ae47a910b97b058d6fa61 (diff)
Shrink pooling_ops_test and unshard
pooling_ops_test is only slow because it uses unnecessarily large sizes. Speed it up by dividing all the depth values coming out of Inception by 30. After this speedup, there is no need to shard. Change: 117867788
Diffstat (limited to 'tensorflow/python/kernel_tests/pooling_ops_test.py')
-rw-r--r--tensorflow/python/kernel_tests/pooling_ops_test.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tensorflow/python/kernel_tests/pooling_ops_test.py b/tensorflow/python/kernel_tests/pooling_ops_test.py
index 3b562e323c..7ec6decfff 100644
--- a/tensorflow/python/kernel_tests/pooling_ops_test.py
+++ b/tensorflow/python/kernel_tests/pooling_ops_test.py
@@ -30,6 +30,7 @@ def NHWCToNCHW(input_tensor):
Args:
input_tensor: a 4-D tensor, or a 4-element array representing the same.
+
Returns:
the converted tensor or a shape array
"""
@@ -44,6 +45,7 @@ def NCHWToNHWC(input_tensor):
Args:
input_tensor: a 4-D tensor, or a 4-element array representing the same.
+
Returns:
the converted tensor or a shape array
"""
@@ -66,9 +68,12 @@ def GetTestConfigs():
return test_configs
-def GetInceptionMaxPoolShapes():
+def GetShrunkInceptionMaxPoolShapes(shrink=30):
"""Iterator for some of the max pool ops in the Inception 2015 model.
+ Args:
+ shrink: Factor to shrink depth relative to Inception.
+
Yields:
Tuple (name, input_size, filter_size, out_size, strides, padding)
"""
@@ -81,6 +86,11 @@ def GetInceptionMaxPoolShapes():
[32, 8, 8, 1248], [32, 8, 8, 2048]]
strides = [[1, 2, 2, 1], [1, 2, 2, 1], [1, 2, 2, 1],
[1, 1, 1, 1]]
+ # Shrink each depth value
+ for i in input_sizes:
+ i[3] //= shrink
+ for o in output_sizes:
+ o[3] //= shrink
paddings = ["VALID", "VALID", "VALID", "SAME"]
for n, i, f, o, s, p in zip(names, input_sizes, filter_sizes, output_sizes,
strides, paddings):
@@ -482,6 +492,8 @@ class PoolingTest(tf.test.TestCase):
use_gpu: whether we are running on GPU
x_init_value: Values to be passed to the gradient checker.
"""
+ assert input_sizes[0] == output_sizes[0]
+ assert input_sizes[3] == output_sizes[3]
total_size = 1
for s in input_sizes:
total_size *= s
@@ -909,7 +921,7 @@ def GetMaxPoolGradTest(input_size, filter_size, output_size, strides, padding):
if __name__ == "__main__":
for (name_, input_size_, filter_size_, output_size_, stride_,
- padding_) in GetInceptionMaxPoolShapes():
+ padding_) in GetShrunkInceptionMaxPoolShapes():
setattr(PoolingTest, "testMaxPoolFwd_" + name_,
GetMaxPoolFwdTest(input_size_, filter_size_, stride_, padding_))
setattr(PoolingTest, "testMaxPoolGrad_" + name_,