Skip to content

Commit 8ec95eb

Browse files
committed
Adding tests for conv-grad when strides > ksize.
1 parent 41a79f6 commit 8ec95eb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tensorflow/python/kernel_tests/conv_ops_test.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,21 @@ def testConv2D2x2Depth3ValidBackpropInputStride1x2(self):
465465
data_format=data_format,
466466
use_gpu=use_gpu)
467467

468+
def testConv2DStrideTwoFilterOneSameBackpropInput(self):
469+
expected_output = [1.0, 0.0, 2.0, 0.0,
470+
0.0, 0.0, 0.0, 0.0,
471+
3.0, 0.0, 4.0, 0.0,
472+
0.0, 0.0, 0.0, 0.0]
473+
for (data_format, use_gpu) in GetTestConfigs():
474+
self._RunAndVerifyBackpropInput(input_sizes=[1, 4, 4, 1],
475+
filter_sizes=[1, 1, 1, 1],
476+
output_sizes=[1, 2, 2, 1],
477+
strides=[2, 2],
478+
padding="SAME",
479+
expected=expected_output,
480+
data_format=data_format,
481+
use_gpu=use_gpu)
482+
468483
# Testing for backprops
469484
def _RunAndVerifyBackpropFilter(self, input_sizes, filter_sizes, output_sizes,
470485
strides, padding, expected, data_format,
@@ -568,6 +583,18 @@ def testConv2D2x2Depth3ValidBackpropFilterStride1x2(self):
568583
data_format=data_format,
569584
use_gpu=use_gpu)
570585

586+
def testConv2DStrideTwoFilterOneSameBackpropFilter(self):
587+
expected_output = [78.]
588+
for (data_format, use_gpu) in GetTestConfigs():
589+
self._RunAndVerifyBackpropFilter(input_sizes=[1, 4, 4, 1],
590+
filter_sizes=[1, 1, 1, 1],
591+
output_sizes=[1, 2, 2, 1],
592+
strides=[2, 2],
593+
padding="SAME",
594+
expected=expected_output,
595+
data_format=data_format,
596+
use_gpu=use_gpu)
597+
571598
# Gradient checkers
572599
def ConstructAndTestGradient(self, batch, input_rows, input_cols, filter_rows,
573600
filter_cols, in_depth, out_depth, stride_rows,

0 commit comments

Comments
 (0)