class_docstr: Computes the log probability density of a trace (of a model with
  tree structure) that possibly contains discrete sample sites
  enumerated in parallel. This will be deprecated in favor of
  :class:`~pyro.infer.mcmc.util.EinsumTraceProbEvaluator`.
  
  :param model_trace: execution trace from a static model.
  :param bool has_enumerable_sites: whether the trace contains any
      discrete enumerable sites.
  :param int max_plate_nesting: Optional bound on max number of nested
      :func:`pyro.plate` contexts.
class_docstr_tok: ["Computes","the","log","probability","density","of","a","trace","(","of","a","model","with","tree","structure",")","that","possibly","contains","discrete","sample","sites","enumerated","in","parallel",".","This","will","be","deprecated","in","favor","of",":","class",":","`","~pyro.infer.mcmc.util.EinsumTraceProbEvaluator","`",".",":","param","model_trace",":","execution","trace","from","a","static","model",".",":","param","bool","has_enumerable_sites",":","whether","the","trace","contains","any","discrete","enumerable","sites",".",":","param","int","max_plate_nesting",":","Optional","bound","on","max","number","of","nested",":","func",":","`","pyro.plate","`","contexts","."]
docstr: Reduce the log prob terms for the given ordinal:
    - taking log_sum_exp of factors in enum dims (i.e.
      adding up the probability terms).
    - summing up the dims within `max_plate_nesting`.
      (i.e. multiplying probs within independent batches).
  
  :param ordinal: node (ordinal)
  :param torch.Tensor agg_log_prob: aggregated `log_prob`
      terms from the downstream nodes.
  :return: `log_prob` with marginalized `plate` and `enum`
      dims.
docstr_tok: ["Reduce","the","log","prob","terms","for","the","given","ordinal",":","-","taking","log_sum_exp","of","factors","in","enum","dims","(","i.e",".","adding","up","the","probability","terms",")",".","-","summing","up","the","dims","within","`","max_plate_nesting","`",".","(","i.e",".","multiplying","probs","within","independent","batches",")",".",":","param","ordinal",":","node","(","ordinal",")",":","param","torch.Tensor","agg_log_prob",":","aggregated","`","log_prob","`","terms","from","the","downstream","nodes",".",":","return",":","`","log_prob","`","with","marginalized","`","plate","`","and","`","enum","`","dims","."]
code: def _reduce(self, ordinal, agg_log_prob=torch.tensor(0.0)):
      """
      Reduce the log prob terms for the given ordinal:
        - taking log_sum_exp of factors in enum dims (i.e.
          adding up the probability terms).
        - summing up the dims within `max_plate_nesting`.
          (i.e. multiplying probs within independent batches).
  
      :param ordinal: node (ordinal)
      :param torch.Tensor agg_log_prob: aggregated `log_prob`
          terms from the downstream nodes.
      :return: `log_prob` with marginalized `plate` and `enum`
          dims.
      """
      log_prob = sum(self._log_probs[ordinal]) + agg_log_prob
      for enum_dim in self._enum_dims[ordinal]:
          log_prob = logsumexp(log_prob, dim=enum_dim, keepdim=True)
      for marginal_dim in self._plate_dims[ordinal]:
          log_prob = log_prob.sum(dim=marginal_dim, keepdim=True)
      return log_prob
  
imports: import functools
  import traceback
  import warnings
  from collections import OrderedDict, defaultdict
  from functools import partial, reduce
  from itertools import product
  import torch
  from opt_einsum import shared_intermediates
  from torch.distributions import biject_to
  import pyro
  import pyro.poutine
  from pyro.distributions.util import broadcast_shape, logsumexp
  from pyro.infer import config_enumerate
  from pyro.infer.autoguide.initialization import InitMessenger, init_to_uniform
  from pyro.infer.util import is_validation_enabled
  from pyro.ops import stats
  from pyro.ops.contract import contract_to_tensor
  from pyro.ops.integrator import potential_grad
  from pyro.poutine.subsample_messenger import _Subsample
  from pyro.poutine.util import prune_subsample_sites
  from pyro.util import check_site_shape, ignore_jit_warnings
label_desc: Use image node_id 5 for calling the TraceTreeEvaluator obj's underlying member method code with example usage: obj._reduce(ordinal, agg_log_prob) and returns: log_prob