# ValueError: Negative dimension size caused by subtracting 5 from 3

I get this error ValueError: Negative dimension size caused by subtracting 5 from 3 for '{{node conv2d_77/Conv2D}} = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], explicit_paddings=[], padding="VALID", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true](conv2d_76/Relu, conv2d_77/Conv2D/ReadVariableOp)' with input shapes: [?,32,8,3], [5,5,32,32].

when I don't have padding = 'same' in my second layer in my model, and I get this error TypeError: add() got an unexpected keyword argument 'padding' when I have it.

Model:


model_cnn.add(Conv2D(filters = 32, kernel_size = (5, 5), activation = 'relu', input_shape = (SIZE, SIZE, 3), padding = 'same'))
model_cnn.add(Conv2D(filters = 32, kernel_size = (5, 5), activation = 'relu'), padding = 'same')

model_cnn.add(Conv2D(filters = 64, kernel_size = (3, 3), activation = 'relu'))
model_cnn.add(Conv2D(filters = 64, kernel_size = (3, 3), activation = 'relu'))

$$$$

The first error you're getting is likely because the input becomes too small for the network to perform a 5 by 5 convolution on. The second error is caused by the fact that you are placing the padding argument in the wrong place. You are currently using it for the model.add call, whereas you should use it with the Conv2D classs:
model_cnn.add(Conv2D(filters = 32, kernel_size = (5, 5), activation = 'relu', padding = 'same'))
`