Answers.Body: <p>Learning &quot;border effects&quot; is another reason to use padding at least in convolutional neural networks. <a href="https://arxiv.org/pdf/2010.02178.pdf" rel="nofollow noreferrer">This paper</a> 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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-27T01:41:02.177Z
Answers.Text: To put simply, padding is used to give priority to corner/border pixels/values, which are often ill-treated without padding!
Answers.UserDisplayName: hanugm
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-27T01:31:57.293Z
Answers.LastActivityDate: 2021-07-27T01:31:57.293Z
Answers.UserDisplayName: CorruptedHeapScapeGoat
Body: <p>Padding is a technique used in some of the domains of artificial intelligence.</p>
  <p>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 <a href="https://ai.stackexchange.com/questions/26597/what-is-the-difference-between-zero-padding-and-character-padding-in-recurrent-n">pad input sentences</a> 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.</p>
  <p>Is handling this type of <em>shape issues</em> 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?</p>
  
Tags: <neural-networks><convolutional-neural-networks><recurrent-neural-networks><padding>
Title: Is reconciling shape discrepancies the only purpose of padding?
UserDisplayName: hanugm
ThreadText: # Is reconciling shape discrepancies the only purpose of padding?
  
  (Asked by: username_0 on 2021-07-26)
  
  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](https://ai.stackexchange.com/questions/26597/what-is-the-difference-between-zero-padding-and-character-padding-in-recurrent-n) 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?
  
  **Tags:** neural-networks, convolutional-neural-networks, recurrent-neural-networks, padding
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-27. Score: 1
  
  Learning "border effects" is another reason to use padding at least in convolutional neural networks. [This paper](https://arxiv.org/pdf/2010.02178.pdf) 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.
  
  > **Comments:**
  > **username_0**: To put simply, padding is used to give priority to corner/border pixels/values, which are often ill-treated without padding!  
  
  ---
  
  