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]))