1
$\begingroup$

Padding is a technique used in some of the domains of artificial intelligence.

Data is generally available in different shapes. But in order to pass the data as input to a model in deep learning, the model allows only a particular shape of data to pass through it. And hence there is a need to allow padding in case if the input data shape contains dimensions that are less than the dimensions of the input of the model under consideration. For example, we pad input sentences in RNN to match the input shape of the RNN model. Sometimes we pad the input data in order to make a desired shape output. For example, padding is used in convolution operation to keep the size of feature maps intact.

Is handling this type of shape issues is the only purpose of padding? If no, what are the other purposes of padding that are not related to the shaping requirements of data?

$\endgroup$

1 Answer 1

1
$\begingroup$

Learning "border effects" is another reason to use padding at least in convolutional neural networks. This paper specifically looks at 2D CNNs for image processing. In my experience, I use pre-padding with 1D CNNs for NLP so my model can learn morphological affixes.

$\endgroup$
1
  • 1
    $\begingroup$ To put simply, padding is used to give priority to corner/border pixels/values, which are often ill-treated without padding! $\endgroup$
    – hanugm
    Jul 27, 2021 at 1:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .