class_docstr: :param trace_dist: a TracePosterior instance representing a Monte Carlo posterior
  
  Marginal histogram distribution.
  Turns a TracePosterior object into a Distribution
  over the return values of the TracePosterior's model.
code: def _weighted_mean(self, value, dim=0):
      weights = self._log_weights.reshape(
          [-1] + (value.dim() - 1) * [1]
      )
      max_weight = weights.max(dim=dim)[0]
      relative_probs = (weights - max_weight).exp()
      return (value * relative_probs).sum(dim=dim) / relative_probs.sum(
          dim=dim
      )
  
imports: import collections
  import functools
  import queue
  import torch
  import pyro.distributions
  import pyro.poutine
  from pyro.distributions.util import logsumexp
  from pyro.infer.abstract_infer import TracePosterior
  from pyro.poutine.runtime import NonlocalExit
label_desc: Use image node_id 7 for calling the HashingMarginal obj's underlying member method code with example usage: obj._weighted_mean(value, dim) and returns: unknown