code: def influence(
      model: torch.nn.Module, src: Tensor, *args: Any
  ) -> Tensor:
      x = src.clone().requires_grad_()
      out = model(x, *args).sum(dim=-1)
  
      influences = []
      for j in range(src.size(0)):
          influence = (
              grad([out[j]], [x], retain_graph=True)[0]
              .abs()
              .sum(dim=-1)
          )
          influences.append(influence / influence.sum())
  
      return torch.stack(influences, dim=0)
  
imports: from typing import Any
  import torch
  from torch import Tensor
  from torch.autograd import grad
label_desc: Use image node_id 1 for calling a global function with example usage: influence(model, src) and returns: torch