From f19c6efb4a8ba60e2492eedc98ef5375abb39dc7 Mon Sep 17 00:00:00 2001 From: Zhenyu Tan Date: Thu, 4 Jun 2020 20:48:52 -0700 Subject: [PATCH] Simplify the padding size calculation PiperOrigin-RevId: 314857566 Change-Id: I64a7fd55406d3b072f90c1150d5df0c17cee6a5f --- tensorflow/python/ops/nn_ops.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tensorflow/python/ops/nn_ops.py b/tensorflow/python/ops/nn_ops.py index c29fcb1f1d6..3d3c0c68de1 100644 --- a/tensorflow/python/ops/nn_ops.py +++ b/tensorflow/python/ops/nn_ops.py @@ -727,10 +727,7 @@ def _with_space_to_batch_base_paddings(filter_shape, num_spatial_dims, # Spatial dimensions of the filters and the upsampled filters in which we # introduce (rate - 1) zeros between consecutive filter values. filter_spatial_shape = filter_shape[:num_spatial_dims] - dilated_filter_spatial_shape = ( - filter_spatial_shape + (filter_spatial_shape - 1) * - (rate_or_const_rate - 1)) - pad_extra_shape = dilated_filter_spatial_shape - 1 + pad_extra_shape = (filter_spatial_shape - 1) * rate_or_const_rate # When full_padding_shape is odd, we pad more at end, following the same # convention as conv2d.