code: def get_saliency(
      model,
      raw_input,
      input,
      label,
      device=None,
      method="integrate_grad",
      layer_path=None,
  ):
      if device == None or type(device) != torch.device:
          device = torch.device(
              "cuda" if torch.cuda.is_available() else "cpu"
          )
  
      model.to(device)
      input = input.to(device)
      if label is not None:
          label = label.to(device)
  
      if input.grad is not None:
          input.grad.zero_()
      if label is not None and label.grad is not None:
          label.grad.zero_()
      model.eval()
      model.zero_grad()
  
      layer_path = layer_path or _get_layer_path(model)
      exp = _get_explainer(method, model, layer_path)
      saliency = exp.explain(input, label, raw_input)
  
      if saliency is not None:
          saliency = saliency.abs().sum(dim=1)[0].squeeze()
          saliency -= saliency.min()
          saliency /= saliency.max() + 1e-20
  
          return saliency.detach().cpu().numpy()
      else:
          return None
  
file_path: tensorwatch/tensorwatch/saliency/saliency.py
imports: from .gradcam import GradCAMExplainer
  from .backprop import VanillaGradExplainer, GradxInputExplainer, SaliencyExplainer, IntegrateGradExplainer, DeconvExplainer, GuidedBackpropExplainer, SmoothGradExplainer
  from .deeplift import DeepLIFTRescaleExplainer
  from .occlusion import OcclusionExplainer
  from .epsilon_lrp import EpsilonLrp
  from .lime_image_explainer import LimeImageExplainer, LimeImagenetExplainer
  import skimage.transform
  import torch
  import math
  from ..None import image_utils
label_desc: Use image node_id 3 for calling a global function with example usage: get_saliency(model, raw_input, input, label, device, method, layer_path) and returns: saliency, None