ResNet-18 consists of four sequential convolution blocks, and the output of the fully-connected (FC) layer following the
last convolution block is used as the global feature global. The output feature
map of a convolution block-l is denoted by Xl ∈ R
C×W×H.
Then I have to add a local branch called keypoint block, which has an architecture similar to a convolution
block, to localize the distribution of key points. So I have to apply channel-wise softmax on the output
feature map of the keypoint layer to estimate the density of a key point over different image locations.
This softmax output is used as a channel-wise keypoint mask, which will allow
me to perform element-wise product of Xl and Ml. The resulting local feature f of block-l is calculated by a channel-wise summation over locations. But I do not how I can do this pytorch.  Can anyone please help me.