code: def _get_common_scale(scales):
      # Check that all enumerated sites share a common subsampling scale.
      # Note that we use a cheap weak comparison by id rather than tensor value, because
      # (1) it is expensive to compare tensors by value, and (2) tensors must agree not
      # only in value but at all derivatives.
      scales_set = set()
      for scale in scales:
          if isinstance(scale, torch.Tensor) and scale.dim():
              raise ValueError(
                  "enumeration only supports scalar poutine.scale"
              )
          scales_set.add(float(scale))
      if len(scales_set) != 1:
          raise ValueError(
              "Expected all enumerated sample sites to share a common poutine.scale, "
              "but found {} different scales.".format(len(scales_set))
          )
      return scales[0]
  
imports: import queue
  import warnings
  import weakref
  from collections import OrderedDict
  import torch
  from opt_einsum import shared_intermediates
  import pyro
  import pyro.distributions
  import pyro.ops.jit
  import pyro.poutine
  from pyro.distributions.util import is_identically_zero
  from pyro.infer.elbo import ELBO
  from pyro.infer.enum import get_importance_trace, iter_discrete_escape, iter_discrete_extend
  from pyro.infer.util import Dice, is_validation_enabled
  from pyro.ops import packed
  from pyro.ops.contract import contract_tensor_tree, contract_to_tensor
  from pyro.ops.rings import SampleRing
  from pyro.poutine.enum_messenger import EnumMessenger
  from pyro.util import check_traceenum_requirements, ignore_jit_warnings, warn_if_nan
label_desc: Use image node_id 1 for calling a global function with example usage: _get_common_scale(scales) and returns: scales