title: Conv2DSlowBackpropInput: Size of out_backprop doesn't match computed but network dimensions work
body: <p>I am working with a segmentation problem and I am using an encoder-decoder architecture that uses dense blocks (<a href="https://arxiv.org/abs/1611.09326" rel="nofollow noreferrer">https://arxiv.org/abs/1611.09326</a>). I have rectangular images (1024,224,1). The custom generators make images and labels be [batch size, 1024,224,1]. When I load the architecture, the summary displays correct dimension both in the downsampling and upsampling. I have dome the math of the network manually as well and everything seems correct. However, when I use the model.fit method, it displays the following error:</p>
  <pre><code>InvalidArgumentError:  Conv2DSlowBackpropInput: Size of out_backprop doesn't match computed: actual = 70, computed = 14 spatial_dim: 3 input: 28 filter: 3 output: 70 stride: 2 dilation: 1
      
  </code></pre>
  <p>Which makes no sense since the summary displays correct dimension. Could someone help me with this? Thank you!</p>
  <pre><code>
  Model: &quot;fcn-densenet&quot;
  __________________________________________________________________________________________________
   Layer (type)                   Output Shape         Param #     Connected to                     
  ==================================================================================================
   input_4 (InputLayer)           [(None, 1024, 224,   0           []                               
                                  1)]                                                               
                                                                                                    
   initial_conv2D (Conv2D)        (None, 1024, 224, 4  432         ['input_4[0][0]']                
                                  8)                                                                
                                                                                                    
   initial_bn (BatchNormalization  (None, 1024, 224, 4  192        ['initial_conv2D[0][0]']         
   )                              8)                                                                
                                                                                                    
   activation_117 (Activation)    (None, 1024, 224, 4  0           ['initial_bn[0][0]']             
                                  8)                                                                
                                                                                                    
   dense_0_0_bn (BatchNormalizati  (None, 1024, 224, 4  192        ['activation_117[0][0]']         
   on)                            8)                                                                
                                                                                                    
   activation_118 (Activation)    (None, 1024, 224, 4  0           ['dense_0_0_bn[0][0]']           
                                  8)                                                                
                                                                                                    
   dense_0_0_conv2D (Conv2D)      (None, 1024, 224, 1  6912        ['activation_118[0][0]']         
                                  6)                                                                
                                                                                                    
   dropout_100 (Dropout)          (None, 1024, 224, 1  0           ['dense_0_0_conv2D[0][0]']       
                                  6)                                                                
                                                                                                    
   concatenate_122 (Concatenate)  (None, 1024, 224, 6  0           ['activation_117[0][0]',         
                                  4)                                'dropout_100[0][0]']            
                                                                                                    
   dense_0_1_bn (BatchNormalizati  (None, 1024, 224, 6  256        ['concatenate_122[0][0]']        
   on)                            4)                                                                
                                                                                                    
   activation_119 (Activation)    (None, 1024, 224, 6  0           ['dense_0_1_bn[0][0]']           
                                  4)                                                                
                                                                                                    
   dense_0_1_conv2D (Conv2D)      (None, 1024, 224, 1  9216        ['activation_119[0][0]']         
                                  6)                                                                
                                                                                                    
   dropout_101 (Dropout)          (None, 1024, 224, 1  0           ['dense_0_1_conv2D[0][0]']       
                                  6)                                                                
                                                                                                    
   concatenate_123 (Concatenate)  (None, 1024, 224, 8  0           ['concatenate_122[0][0]',        
                                  0)                                'dropout_101[0][0]']            
                                                                                                    
   tr_0_bn (BatchNormalization)   (None, 1024, 224, 8  320         ['concatenate_123[0][0]']        
                                  0)                                                                
                                                                                                    
   activation_120 (Activation)    (None, 1024, 224, 8  0           ['tr_0_bn[0][0]']                
                                  0)                                                                
                                                                                                    
   tr_0_conv2D (Conv2D)           (None, 1024, 224, 8  6400        ['activation_120[0][0]']         
                                  0)                                                                
                                                                                                    
   max_pooling2d_11 (MaxPooling2D  (None, 512, 112, 80  0          ['tr_0_conv2D[0][0]']            
   )                              )                                                                 
                                                                                                    
   dense_1_0_bn (BatchNormalizati  (None, 512, 112, 80  320        ['max_pooling2d_11[0][0]']       
   on)                            )                                                                 
                                                                                                    
   activation_121 (Activation)    (None, 512, 112, 80  0           ['dense_1_0_bn[0][0]']           
                                  )                                                                 
                                                                                                    
   dense_1_0_conv2D (Conv2D)      (None, 512, 112, 16  11520       ['activation_121[0][0]']         
                                  )                                                                 
                                                                                                    
   dropout_102 (Dropout)          (None, 512, 112, 16  0           ['dense_1_0_conv2D[0][0]']       
                                  )                                                                 
                                                                                                    
   concatenate_124 (Concatenate)  (None, 512, 112, 96  0           ['max_pooling2d_11[0][0]',       
                                  )                                 'dropout_102[0][0]']            
                                                                                                    
   dense_1_1_bn (BatchNormalizati  (None, 512, 112, 96  384        ['concatenate_124[0][0]']        
   on)                            )                                                                 
                                                                                                    
   activation_122 (Activation)    (None, 512, 112, 96  0           ['dense_1_1_bn[0][0]']           
                                  )                                                                 
                                                                                                    
   dense_1_1_conv2D (Conv2D)      (None, 512, 112, 16  13824       ['activation_122[0][0]']         
                                  )                                                                 
                                                                                                    
   dropout_103 (Dropout)          (None, 512, 112, 16  0           ['dense_1_1_conv2D[0][0]']       
                                  )                                                                 
                                                                                                    
   concatenate_125 (Concatenate)  (None, 512, 112, 11  0           ['concatenate_124[0][0]',        
                                  2)                                'dropout_103[0][0]']            
                                                                                                    
   tr_1_bn (BatchNormalization)   (None, 512, 112, 11  448         ['concatenate_125[0][0]']        
                                  2)                                                                
                                                                                                    
   activation_123 (Activation)    (None, 512, 112, 11  0           ['tr_1_bn[0][0]']                
                                  2)                                                                
                                                                                                    
   tr_1_conv2D (Conv2D)           (None, 512, 112, 11  12544       ['activation_123[0][0]']         
                                  2)                                                                
                                                                                                    
   max_pooling2d_12 (MaxPooling2D  (None, 256, 56, 112  0          ['tr_1_conv2D[0][0]']            
   )                              )                                                                 
                                                                                                    
   dense_2_0_bn (BatchNormalizati  (None, 256, 56, 112  448        ['max_pooling2d_12[0][0]']       
   on)                            )                                                                 
                                                                                                    
   activation_124 (Activation)    (None, 256, 56, 112  0           ['dense_2_0_bn[0][0]']           
                                  )                                                                 
                                                                                                    
   dense_2_0_conv2D (Conv2D)      (None, 256, 56, 16)  16128       ['activation_124[0][0]']         
                                                                                                    
   dropout_104 (Dropout)          (None, 256, 56, 16)  0           ['dense_2_0_conv2D[0][0]']       
                                                                                                    
   concatenate_126 (Concatenate)  (None, 256, 56, 128  0           ['max_pooling2d_12[0][0]',       
                                  )                                 'dropout_104[0][0]']            
                                                                                                    
   dense_2_1_bn (BatchNormalizati  (None, 256, 56, 128  512        ['concatenate_126[0][0]']        
   on)                            )                                                                 
                                                                                                    
   activation_125 (Activation)    (None, 256, 56, 128  0           ['dense_2_1_bn[0][0]']           
                                  )                                                                 
                                                                                                    
   dense_2_1_conv2D (Conv2D)      (None, 256, 56, 16)  18432       ['activation_125[0][0]']         
                                                                                                    
   dropout_105 (Dropout)          (None, 256, 56, 16)  0           ['dense_2_1_conv2D[0][0]']       
                                                                                                    
   concatenate_128 (Concatenate)  (None, 256, 56, 32)  0           ['dropout_104[0][0]',            
                                                                    'dropout_105[0][0]']            
                                                                                                    
   tr_up_0_conv2DT (Conv2DTranspo  (None, 512, 112, 32  9248       ['concatenate_128[0][0]']        
   se)                            )                                                                 
                                                                                                    
   concatenate_129 (Concatenate)  (None, 512, 112, 14  0           ['tr_up_0_conv2DT[0][0]',        
                                  4)                                'concatenate_125[0][0]']        
                                                                                                    
   dense_3_0_bn (BatchNormalizati  (None, 512, 112, 14  576        ['concatenate_129[0][0]']        
   on)                            4)                                                                
                                                                                                    
   activation_126 (Activation)    (None, 512, 112, 14  0           ['dense_3_0_bn[0][0]']           
                                  4)                                                                
                                                                                                    
   dense_3_0_conv2D (Conv2D)      (None, 512, 112, 16  20736       ['activation_126[0][0]']         
                                  )                                                                 
                                                                                                    
   dropout_106 (Dropout)          (None, 512, 112, 16  0           ['dense_3_0_conv2D[0][0]']       
                                  )                                                                 
                                                                                                    
   concatenate_130 (Concatenate)  (None, 512, 112, 16  0           ['concatenate_129[0][0]',        
                                  0)                                'dropout_106[0][0]']            
                                                                                                    
   dense_3_1_bn (BatchNormalizati  (None, 512, 112, 16  640        ['concatenate_130[0][0]']        
   on)                            0)                                                                
                                                                                                    
   activation_127 (Activation)    (None, 512, 112, 16  0           ['dense_3_1_bn[0][0]']           
                                  0)                                                                
                                                                                                    
   dense_3_1_conv2D (Conv2D)      (None, 512, 112, 16  23040       ['activation_127[0][0]']         
                                  )                                                                 
                                                                                                    
   dropout_107 (Dropout)          (None, 512, 112, 16  0           ['dense_3_1_conv2D[0][0]']       
                                  )                                                                 
                                                                                                    
   concatenate_132 (Concatenate)  (None, 512, 112, 32  0           ['dropout_106[0][0]',            
                                  )                                 'dropout_107[0][0]']            
                                                                                                    
   tr_up_1_conv2DT (Conv2DTranspo  (None, 1024, 224, 3  9248       ['concatenate_132[0][0]']        
   se)                            2)                                                                
                                                                                                    
   concatenate_133 (Concatenate)  (None, 1024, 224, 1  0           ['tr_up_1_conv2DT[0][0]',        
                                  12)                               'concatenate_123[0][0]']        
                                                                                                    
   dense_4_0_bn (BatchNormalizati  (None, 1024, 224, 1  448        ['concatenate_133[0][0]']        
   on)                            12)                                                               
                                                                                                    
   activation_128 (Activation)    (None, 1024, 224, 1  0           ['dense_4_0_bn[0][0]']           
                                  12)                                                               
                                                                                                    
   dense_4_0_conv2D (Conv2D)      (None, 1024, 224, 1  16128       ['activation_128[0][0]']         
                                  6)                                                                
                                                                                                    
   dropout_108 (Dropout)          (None, 1024, 224, 1  0           ['dense_4_0_conv2D[0][0]']       
                                  6)                                                                
                                                                                                    
   concatenate_134 (Concatenate)  (None, 1024, 224, 1  0           ['concatenate_133[0][0]',        
                                  28)                               'dropout_108[0][0]']            
                                                                                                    
   dense_4_1_bn (BatchNormalizati  (None, 1024, 224, 1  512        ['concatenate_134[0][0]']        
   on)                            28)                                                               
                                                                                                    
   activation_129 (Activation)    (None, 1024, 224, 1  0           ['dense_4_1_bn[0][0]']           
                                  28)                                                               
                                                                                                    
   dense_4_1_conv2D (Conv2D)      (None, 1024, 224, 1  18432       ['activation_129[0][0]']         
                                  6)                                                                
                                                                                                    
   dropout_109 (Dropout)          (None, 1024, 224, 1  0           ['dense_4_1_conv2D[0][0]']       
                                  6)                                                                
                                                                                                    
   concatenate_135 (Concatenate)  (None, 1024, 224, 1  0           ['concatenate_134[0][0]',        
                                  44)                               'dropout_109[0][0]']            
                                                                                                    
   conv2d_3 (Conv2D)              (None, 1024, 224, 3  432         ['concatenate_135[0][0]']        
                                  )                                                                 
                                                                                                    
   reshape_6 (Reshape)            (None, 229376, 3)    0           ['conv2d_3[0][0]']               
                                                                                                    
   activation_130 (Activation)    (None, 229376, 3)    0           ['reshape_6[0][0]']              
                                                                                                    
   reshape_7 (Reshape)            (None, 1024, 224, 3  0           ['activation_130[0][0]']         
                                  )                                                                 
                                                                                                    
  ==================================================================================================
  Total params: 197,920
  Trainable params: 195,296
  Non-trainable params: 2,624
  __________________________________________________________________________________________________
  
  </code></pre>