It consider Bxhxw as batch dimensions. And 1x(bb) and (bb)xn for the other dimensions of each other dimensions.
Doing the matrix multiply between the two, will give you a Tensor with 1xn and with the same batch size.
The squeeze removes the dimension of size 1.