ValueError: Negative dimension size caused by subtracting 2 from 1 for…

ValueError: Negative dimension size caused by subtracting 2 from 1 for ‘{{node max_pooling2d_1/MaxPool}} = MaxPoolT=DT_FLOAT, data_format=“NHWC”, explicit_paddings=[], ksize=[1, 2, 2, 1], padding=“VALID”, strides=[1, 2, 2, 1]’ with input shapes: [?,1,128,64].
channel Order problem
Add the code
from keras import backend as K
K.set_image_data_format(‘channel_first’)
Done!

Read More: