Simplicity
Simplicity

Reputation: 48916

Conv2d and the value of padding

I would like to ask about the value of padding we set in the Conv2d function.

I know what zero-padding is. However, what does it mean that the padding is 0 for instance, or 1,2, or 3. What do these values mean? Do they represent the number of columns and rows that will be filled with zeros?

Thanks a lot.

Upvotes: 0

Views: 880

Answers (1)

Shai
Shai

Reputation: 114786

As the documentation states:

padding controls the amount of implicit zero-paddings on both sides for padding number of points for each dimension.

Therefore, padding=1 means you pad your input with 1 column and row from each size.
If you want more control over the amount of padding and its value you can either use a Padding layer, or the pad functional.

Upvotes: 1

Related Questions