Valid padding: It is used when there is no requirement for padding. The output matrix will have the dimensions (n – f + 1) X (n – f + 1) after convolution.
Same padding: Here, padding elements are added all around the output matrix. It will have the same dimensions as the input matrix.