Size difference during backpropagation between fully connected layer and convolution layer?

This is a simple example of a network consisting of two convolutional layers and one fully connected layer.

target = 10x1 
input  = 15x15 
con_1  =  5x5 // filter size
con_2  =  3x3 // filter size
fc     =  10x81
// forward pass
out_1 = convolution(input,con_1) = 11x11
out_2 = convolution(out_1,con_2  = 9x9
out_3 = matrix multiplication(fc,out_2)
// backward pass
fc_err = err from fully connected layer
con_2_err = convolution(filter con_2,fc_err)// result 10x10
gradient = convolution(out_1,con_2_err) // result 2x2

After I find the error at the fc level, I have to pass it at conv_2 convolution level. My concern is that the error is 10x1 in size and the con_2 filter is 3x3 in size. So it should be? If so, then I need to bring the size of the filter 3x3 to 10x10, and then the result of the convolution will be a 10x10 matrix. The gradient for the layer con_2 will be the result of the convolution of out_1 and con_2_err, which will give a 2x2 matrix. To update the weight of the con_2 filter, I need a 3x3 gradient. What am I doing wrong ? Sorry for the large text and my English, I just want to understand why the size of the gradient does not match the size of the filter.

Topic cnn backpropagation implementation

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.