The code is little long, so I request you to check it on this Google Colab link.
I am building an Auto-Encoder. I worked fine at first, but after adding one more CNN layer, I mean after changing this layer_filters = [32, 64] to layer_filters = [32, 64, 128] I am getting a dimension error.
This one:
ValueError: Dimensions must be equal, but are 32 and 28 for '{{node mean_squared_error/SquaredDifference}} = SquaredDifference[T=DT_FLOAT](autoencoders/decoder/decoder_output/Sigmoid, IteratorGetNext:1)' with input shapes: [32,32,32,1], [32,28,28,1].
I think Encoders dimensions and Decoder's dimensions are different due to adding of one more layer. I don't know how to make them same. Can anyone help ?
EDIT - @Kaveh has answered this question below, I did what he said, and it worked. So if anyone is visiting this question now. Please note that the notebook that I mention earlier has been updated and has no trace back.
(None, 28, 28, 1)and the decoder output dimension is(None, 32, 32, 1). You are sendingX_trainto both of them inautoencoder.fit(). Same forX_test. So, this means thatX_train, andX_testhave the dimension of(None, 32, 32, 1)which is incompatible with the encoder input dimension(None, 28, 28, 1). TL;DR: as encoder input and decoder output both end are getting same input, their dimensions should be the same.