Dimension error when multiplying weights and logits

I am implementing the paper
Deep multiscale convolutional feature learning for weakly supervised localization of chest pathologies in X-ray images

According to my understanding the layer relevance weights belong to the last layer of each dense block, with the dimension(N, 128,3,3) and logits from FC layer have dimension (1,1).

So Far i have implemented the code below:

 def weight_constraints(self):

        weights= {'feat1': self.model.features.denseblock2.denselayer12.conv2.weight.data,
            'feat2':self.model.features.denseblock3.denselayer24.conv2.weight.data,
            'feat3':self.model.features.denseblock4.denselayer16.conv2.weight.data}

        sum(weights.values()) == 1

        for i in weights.keys():
            w = weights[i]    
            w1 = w.clamp(min= 0)
            w = w1
        return weights


 weights= self.weight_constraints()
        for i in weights.keys():
            w = weights[i]
            l = logits[i]
            p = torch.matmul(w , l[0])
            sum = sum + p 

and

logits = {‘feat1’: [tensor([[-0.0630]], …ackward0>)], ‘feat2’: [tensor([[-0.0323]], …ackward0>)], ‘feat3’: [tensor([[-8.2897e-06…ackward0>)]}

i get the following error:

mat1 and mat2 shapes cannot be multiplied (12288x3 and 1x1)

Please guide me if i am using the right approach and what is causing the issue.

@ptrblck @smth
looking forward to your response