1 TensorFlow给出的定义
The TensorFlow Convolution example gives an overview about the difference between SAME and VALID :
For the SAME padding, the output height and width are computed as:
out_height = ceil(float(in_height) / float(strides[1]))
out_width = ceil(float(in_width) / float(strides[2]))
And
For the VALID padding, the output height and width are computed as:
out_height = ceil(float(in_height - filter_height + 1) / float(strides1))
out_width = ceil(float(in_width - filter_width + 1) / float(strides[2]))
2 别人的解释
3 我的总结
- valid: 周围不填0进行卷积运算,无法计算的部分(矩阵的右边和下面)直接舍去。
计算公式:
out_height = ceil(float(in_height - filter_height + 1) / float(strides1))
out_width = ceil(float(in_width - filter_width + 1) / float(strides[2])) - same: 周围填0进行卷积运算,0在矩阵的左右和上下均匀添加,非均匀时多的加在右边和下面。
计算公式:
out_height = ceil(float(in_height) / float(strides[1]))
out_width = ceil(float(in_width) / float(strides[2]))