code: def get_cam(imggrad, conv_out):
      
      weights = np.mean(imggrad, axis=(1, 2))
      cam = np.ones(conv_out.shape[1:], dtype=np.float32)
      for i, w in enumerate(weights):
          cam += w * conv_out[i, :, :]
      cam = cv2.resize(cam, (imggrad.shape[1], imggrad.shape[2]))
      cam = np.maximum(cam, 0)
      cam = (cam - np.min(cam)) / (np.max(cam) - np.min(cam)) 
      cam = np.uint8(cam * 255)
      return cam
docs: Compute CAM. Refer section 3 of https://arxiv.org/abs/1610.02391 for details