You don’t need the weights (parameters) of a layer to compute the heatmap with gradcam. What you actually need is the activation maps (output of a layer). You can retrieve that with a forward hook torch.nn.modules.module.register_module_forward_hook — PyTorch 1.8.1 documentation 4
If you refer to the original grad-cam paper (https://arxiv.org/pdf/1610.02391.pdf 2) there are three steps to compute the activation map:

Find the activations A and y of a conv (or other) layer and the output layer (done with a forward hook)
compute the importance weights alpha = mean(dy/dA) (Eq. 1)
compute the activation map ReLU(sum(alpha*A)) (Eq.2)