code: def stack(arr_iter):
      from pgmpy import config
  
      if config.BACKEND == "numpy":
          return np.stack(tuple(arr_iter))
      else:
          return torch.stack(tuple(arr_iter))
  
file_path: pgmpy/pgmpy/utils/compat_fns.py
imports: from copy import deepcopy
  import numpy
  import torch
label_desc: Use image node_id 7 for calling a global function with example usage: stack(arr_iter) and returns: np, torch