Is this implementation for GradCam correct?

It shows no errors but what I get is simply a red square. If the model was wrong, I would expect at least an incorrect gradcam but I’m not sure. Also, I just modified the class to receive a custom model (basically ResNet18) and the same last 4th layer is chosen.

Thank you!

@GustavoVargasHakim the code looks alright
Can you share your code on how you are using it