code: def transpose(arr, axis):
      if isinstance(arr, np.ndarray):
          return np.transpose(arr, axes=axis)
      else:
          return torch.permute(arr, dims=axis)
  
file_path: pgmpy/pgmpy/utils/compat_fns.py
imports: from copy import deepcopy
  import numpy
  import torch
label_desc: Use image node_id 14 for calling a global function with example usage: transpose(arr, axis) and returns: np, torch