code: def _guess_max_plate_nesting(model, args, kwargs):
      """
      Guesses max_plate_nesting by running the model once
      without enumeration. This optimistically assumes static model
      structure.
      """
      with poutine.block():
          model_trace = poutine.trace(model).get_trace(*args, **kwargs)
      sites = [
          site
          for site in model_trace.nodes.values()
          if site["type"] == "sample"
      ]
  
      dims = [
          frame.dim
          for site in sites
          for frame in site["cond_indep_stack"]
          if frame.vectorized
      ]
      max_plate_nesting = -min(dims) if dims else 0
      return max_plate_nesting
  
file_path: pyro/pyro/infer/predictive.py
imports: import warnings
  from functools import reduce
  import torch
  import pyro
  import pyro.poutine
  from pyro.poutine.util import prune_subsample_sites
label_desc: Use image node_id 1 for calling a global function with example usage: _guess_max_plate_nesting(model, args, kwargs) and returns: max_plate_nesting