code: def _reshape_attr_and_get_heatmap(
      image_relevance: torch.Tensor,
      img_tensor: torch.Tensor,
      img_size=224,
  ) -> np.ndarray:
      side_length = int(np.sqrt(image_relevance.shape[-1]))
      image_relevance = image_relevance.reshape(
          1, 1, side_length, side_length
      )
      image_relevance = torch.nn.functional.interpolate(
          image_relevance, size=img_size, mode="bilinear"
      )
      image_relevance = (
          image_relevance.reshape(img_size, img_size).data.cpu().numpy()
      )
      image_relevance = (image_relevance - image_relevance.min()) / (
          image_relevance.max() - image_relevance.min()
      )
      if len(img_tensor.shape) == 4:
          img_tensor = img_tensor[0]
      img_np = img_tensor.permute(1, 2, 0).data.cpu().numpy()
      img_np = (img_np - img_np.min()) / (img_np.max() - img_np.min())
      vis = _add_cam_on_image(img_np, image_relevance)
      vis = np.uint8(255 * vis)
      vis = cv2.cvtColor(np.array(vis), cv2.COLOR_RGB2BGR)
      return vis
  
file_path: towhee/towhee/models/visualization/transformer_visualization.py
imports: from typing import Any
  from torch import nn
  import torch
  from torchvision import transforms
  import numpy
  from towhee.utils.pil_utils import PILImage
  from towhee.utils.cv2_utils import cv2
  from towhee.trainer.utils.file_utils import is_matplotlib_available
  from towhee.utils.log import models_log
label_desc: Use image node_id 2 for calling a global function with example usage: _reshape_attr_and_get_heatmap(image_relevance, img_tensor, img_size) and returns: vis