code: def shoot_infs(inp_tensor):
      """Replaces inf by maximum of tensor"""
      mask_inf = torch.isinf(inp_tensor)
      ind_inf = torch.nonzero(mask_inf, as_tuple=False)
      if len(ind_inf) > 0:
          for ind in ind_inf:
              if len(ind) == 2:
                  inp_tensor[ind[0], ind[1]] = 0
              elif len(ind) == 1:
                  inp_tensor[ind[0]] = 0
          m = torch.max(inp_tensor)
          for ind in ind_inf:
              if len(ind) == 2:
                  inp_tensor[ind[0], ind[1]] = m
              elif len(ind) == 1:
                  inp_tensor[ind[0]] = m
      return inp_tensor
  
imports: import os
  import copy
  import math
  import json
  import collections
  import numpy
  import pandas
  import torch
  import torch.nn
  import torch.optim
  import torch.nn.functional
  from tqdm import tqdm
  from qlib.utils import get_or_create_path
  from qlib.log import get_module_logger
  from qlib.model.base import Model
label_desc: Use image node_id 3 for calling a global function with example usage: shoot_infs(inp_tensor) and returns: inp_tensor