Based on the error message the heatmap and imgOriginal are two numpy arrays in different shapes, which cannot be accumulated:
heatmap = np.random.randn(1024,)
imgOriginal = np.random.randn(7, 7)
img = heatmap * 0.5 + imgOriginal
> ValueError: operands could not be broadcast together with shapes (1024,) (7,7) 

so you would have to make sure the heatmap has the same shape as imgOriginal (or can be broadcasted).
I’m also unsure, what exactly is happening in these lines of code:
heatmap = weights[i] * map

as it seems you are indexing the weight matrix of the last linear layer and are multiplying it with a channel of an output activation of a conv layer.