code: def _guess_max_plate_nesting(model: callable) -> int:
      with torch.no_grad(), poutine.block(), poutine.mask(mask=False):
          trace = poutine.trace(model).get_trace()
      plate_nesting = {0}.union(
          -f.dim
          for site in trace.nodes.values()
          for f in site.get("cond_indep_stack", [])
          if f.vectorized
      )
      return max(plate_nesting)
  
file_path: pyro/pyro/infer/resampler.py
imports: from typing import Callable, Dict, Optional
  import torch
  import pyro
  import pyro.poutine
  from pyro.poutine.trace_struct import Trace
  from pyro.poutine.util import site_is_subsample
label_desc: Use image node_id 2 for calling a global function with example usage: _guess_max_plate_nesting(model) and returns: max