-2

What does padding argument do in keras?

In NLP:

tf.keras.preprocessing.sequence.pad_sequences(xtrain, padding='')

In CNN:

model.add(Convolution2D(64,(3,3),padding=''))
Abhimanyu Sharma
  • 858
  • 1
  • 9
  • 17

1 Answers1

1

With pad_sequences it simply indicates whether sequences that are shorter than the specified max length (or, if unspecified, the length of the longest sequence in xtrain) are filled with the padding value in the beginning or in the end of the sequence (such as to attain the desired length).

With Convolution2d it indicates whether to pad (i.e. extend the tensor (e.g. pixel matrix or feature map) with additional rows and columns outside the border) or not.

I suggest looking into the respective documentations.

Michael Hodel
  • 2,845
  • 1
  • 5
  • 10