class_docstr: An implementation of the DiCE operator compatible with Pyro features.
  
  This implementation correctly handles:
  - scaled log-probability due to subsampling
  - independence in different ordinals due to plate
  - weights due to parallel and sequential enumeration
  - weights due to local multiple sampling
  
  This assumes restricted dependency structure on the model and guide:
  variables outside of an :class:`~pyro.plate` can never depend on
  variables inside that :class:`~pyro.plate`.
  
  References:
  [1] Jakob Foerster, Greg Farquhar, Maruan Al-Shedivat, Tim Rocktaeschel,
      Eric P. Xing, Shimon Whiteson (2018)
      "DiCE: The Infinitely Differentiable Monte-Carlo Estimator"
      https://arxiv.org/abs/1802.05098
  [2] Laurence Aitchison (2018)
      "Tensor Monte Carlo: particle methods for the GPU era"
      https://arxiv.org/abs/1806.08593
  
  :param pyro.poutine.trace.Trace guide_trace: A guide trace.
  :param ordering: A dictionary mapping model site names to ordinal values.
      Ordinal values may be any type that is (1) ``<=`` comparable and (2)
      hashable; the canonical ordinal is a ``frozenset`` of site names.
docstr: Returns a list of DiCE factors at a given ordinal.
docstr_tok: ["Returns","a","list","of","DiCE","factors","at","a","given","ordinal","."]
code: def _get_log_factors(self, target_ordinal):
      """
      Returns a list of DiCE factors at a given ordinal.
      """
      log_denom = 0
      for ordinal, term in self.log_denom.items():
          if not ordinal <= target_ordinal:  # not downstream
              log_denom += (
                  term  # term = log(# times this ordinal is counted)
              )
  
      log_factors = (
          [] if is_identically_zero(log_denom) else [-log_denom]
      )
      for ordinal, terms in self.log_probs.items():
          if ordinal <= target_ordinal:  # upstream
              log_factors.extend(
                  terms
              )  # terms = [log(dice weight of this ordinal)]
  
      return log_factors
  
imports: import math
  import numbers
  from collections import Counter, defaultdict
  from contextlib import contextmanager
  import torch
  from opt_einsum import shared_intermediates
  from opt_einsum.sharing import count_cached_ops
  from pyro.distributions.util import is_identically_zero
  from pyro.ops import packed
  from pyro.ops.einsum.adjoint import require_backward
  from pyro.ops.rings import MarginalRing
  from pyro.poutine.util import site_is_subsample
  from ..None import settings
label_desc: Use image node_id 2 for calling the Dice obj's underlying member method code with example usage: obj._get_log_factors(target_ordinal) and returns: log_factors