code: def max(arr, axis=None):
      if axis is not None:
          axis = tuple(axis)
  
      if isinstance(arr, np.ndarray):
          return np.max(arr, axis=axis)
      else:
          return torch.amax(arr, dim=axis)
  
file_path: pgmpy/pgmpy/utils/compat_fns.py
imports: from copy import deepcopy
  import numpy
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: max(arr, axis) and returns: np, torch