Simplify the padding size calculation
PiperOrigin-RevId: 314857566 Change-Id: I64a7fd55406d3b072f90c1150d5df0c17cee6a5f
This commit is contained in:
parent
0418b68c73
commit
f19c6efb4a
|
@ -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
|
# Spatial dimensions of the filters and the upsampled filters in which we
|
||||||
# introduce (rate - 1) zeros between consecutive filter values.
|
# introduce (rate - 1) zeros between consecutive filter values.
|
||||||
filter_spatial_shape = filter_shape[:num_spatial_dims]
|
filter_spatial_shape = filter_shape[:num_spatial_dims]
|
||||||
dilated_filter_spatial_shape = (
|
pad_extra_shape = (filter_spatial_shape - 1) * rate_or_const_rate
|
||||||
filter_spatial_shape + (filter_spatial_shape - 1) *
|
|
||||||
(rate_or_const_rate - 1))
|
|
||||||
pad_extra_shape = dilated_filter_spatial_shape - 1
|
|
||||||
|
|
||||||
# When full_padding_shape is odd, we pad more at end, following the same
|
# When full_padding_shape is odd, we pad more at end, following the same
|
||||||
# convention as conv2d.
|
# convention as conv2d.
|
||||||
|
|
Loading…
Reference in New Issue