GradCAM always return the same base image

I tried to produce the GradCAM on different classes through a loop. However, I found that all the underlying images are the same, only the gradient is different. This is my code.

class Hook():
    def __init__(self, m):
        self.hook = m.register_forward_hook(self.hook_func)   
    def hook_func(self, m, i, o): self.stored = o.detach().clone()
    def __enter__(self, *args): return self
    def __exit__(self, *args): self.hook.remove()

class HookBwd():
    def __init__(self, m):
        self.hook = m.register_backward_hook(self.hook_func)   
    def hook_func(self, m, gi, go): self.stored = go[0].detach().clone()
    def __enter__(self, *args): return self
    def __exit__(self, *args): self.hook.remove()

for i in imgs:
  x, = first(data.test_dl([img]))
  with HookBwd(learn.model[0]) as hookg:
      with Hook(learn.model[0]) as hook:
          output = learn.model.eval()(x.cuda())
          act = hook.stored
      grad = hookg.stored
  w = grad[0].mean(dim=[1,2], keepdim=True)
  cam_map = (w * act[0]).sum(0)
  _,ax = plt.subplots()
  ax.imshow(cam_map.detach().cpu(), alpha=0.6, extent=(0,224,224,0),
                interpolation='bilinear', cmap='magma');

I have no idea why.