How Convolutional Neural Networks work
So I was watching this video as a refresher on how the math behind convolution works and you can see he is multiplying each pixel with the corresponding weight values from the filter. Then the equation shows summing all the values and then find it’s average. In Pytorch if you make a dummy data input like:
input = torch.rand(1, 1, 2, 2)

filter = nn.Conv2d(1, 1, kernel_size=2)

result = x(foo)

# Double checking the process

double_check = input * filter.weight + filter.bias

# Double_check would hold the same value as result variable.
# But as you can see we didn't do 

(input * filter.weight) / numbers of input and weight pairs + filter.bias

So can someone please tell me why we don’t average first then add the bias?