torch.Size([3, 64, 349, 349])
torch.Size([3, 64, 199, 349])
torch.Size([3, 64, 349, 349])
torch.Size([3, 64, 199, 349])
torch.Size([3, 64, 349, 349])
torch.Size([2, 64, 199, 349])
torch.Size([3, 64, 349, 349])
RuntimeError                              Traceback (most recent call last)
 in ()
21
22         # forward pass
—> 23         outputs = model(images)
24         loss = criterion(outputs, labels)
25
1 frames
 in forward(self, x)
173     print(main_out.shape)
174     print(Attentiom_map.shape)
 → 175     out1 = torch.matmul(main_out, Attentiom_map)
176     max_pool1 = self.pool(torch.add(main_out, out1))
177     # print(max_pool1.shape)
RuntimeError: The size of tensor a (2) must match the size of tensor b (3) at non-singleton dimension 0
main_out = self.pool1(F.relu(self.conv(x)))
Attentiom_map = Attentiom_map.repeat(3, 64, 1, 1)
Attentiom_map = F.interpolate(Attentiom_map, size=(main_out.data[0].shape[2], main_out.data[0].shape[2]), mode=‘bilinear’, align_corners=False)
out1 = torch.matmul(main_out, Attentiom_map)