tensorflow卷积中padding包括"valid"
or "same"
.
关于这两种方式网上很多,这里不再赘述,贴上官方解释:
"valid"
means no padding. "same"
results in padding evenly to the left/right or up/down of the input such that output has the same height/width dimension as the input.
其实还有第三种方式:[[0, 0], [pad_top,pad_bottom], [pad_left, pad_right], [0, 0]]
When explicit padding is used and data_format is "NHWC"
, this should be in the form [[0, 0], [pad_top,pad_bottom], [pad_left, pad_right], [0, 0]]
. When explicit padding used and data_format is "NCHW"
, this should be in the form [[0, 0], [0, 0],[pad_top, pad_bottom], [pad_left, pad_right]]。
通过这种方式,我们可以人为控制图片上、下、左、右扩张的行数,便于调控通过该卷积层后的size。