class_docstr: Replica Exchange MCMC [@swendsen1986replica; @hukushima1996exchange].
  
  #### Examples
  ```python
  cat = Categorical(probs=[0.5,0.5])
  x = Mixture(cat=cat, components=[
      MultivariateNormalDiag([0.0,0.0], [1.0,1.0]),
      MultivariateNormalDiag([10.0,10.0], [1.0,1.0])])
  proposal_x = MultivariateNormalDiag(x, [1.0,1.0])
  qx = Empirical(tf.Variable(tf.zeros([10000, 2])))
  inference = ed.ReplicaExchangeMC(latent_vars={x: qx},
                                   proposal_vars={x: proposal_x})
  ```
class_docstr_tok: ["Replica","Exchange","MCMC","[","@","swendsen1986replica",";","@","hukushima1996exchange","]",".","#","#","#","#","Examples","``","`","python","cat","=","Categorical","(","probs=","[","0.5,0.5","]",")","x","=","Mixture","(","cat=cat",",","components=","[","MultivariateNormalDiag","(","[","0.0,0.0","]",",","[","1.0,1.0","]",")",",","MultivariateNormalDiag","(","[","10.0,10.0","]",",","[","1.0,1.0","]",")","]",")","proposal_x","=","MultivariateNormalDiag","(","x",",","[","1.0,1.0","]",")","qx","=","Empirical","(","tf.Variable","(","tf.zeros","(","[","10000",",","2","]",")",")",")","inference","=","ed.ReplicaExchangeMC","(","latent_vars=","{","x",":","qx","}",",","proposal_vars=","{","x",":","proposal_x","}",")","``","`"]
code: def _replica_ratio(self, replica_ratio, replica_sample):
      replica_ratio = tf.assign(
          replica_ratio,
          tf.zeros(
              self.n_replica, dtype=list(self.latent_vars)[0].dtype
          ),
      )
  
      dict_swap = {}
      for x, qx in six.iteritems(self.data):
          if isinstance(x, RandomVariable):
              if isinstance(qx, RandomVariable):
                  qx_copy = copy(qx, scope="conditional")
                  dict_swap[x] = qx_copy.value()
              else:
                  dict_swap[x] = qx
  
      for i in range(self.n_replica):
          dict_swap_i = dict_swap.copy()
          dict_swap_i.update(replica_sample[i])
  
          base_scope = (
              tf.get_default_graph().unique_name("inference") + "/"
          )
          scope_i = base_scope + "_%d" % i
  
          for z in six.iterkeys(self.latent_vars):
              # Build priors p(z_i) and p(z_j).
              z_i = copy(z, dict_swap_i, scope=scope_i)
              # Increment ratio.
              replica_ratio = tf.scatter_update(
                  replica_ratio,
                  i,
                  replica_ratio[i]
                  + tf.reduce_sum(z_i.log_prob(dict_swap_i[z])),
              )
  
          for x in six.iterkeys(self.data):
              if isinstance(x, RandomVariable):
                  # Build likelihoods p(x | z_i) and p(x | z_j).
                  x_z_i = copy(x, dict_swap_i, scope=scope_i)
                  # Increment ratio.
                  replica_ratio = tf.scatter_update(
                      replica_ratio,
                      i,
                      replica_ratio[i]
                      + tf.reduce_sum(x_z_i.log_prob(dict_swap[x])),
                  )
      return replica_ratio
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import six
  import tensorflow
  import numpy
  from collections import OrderedDict
  from edward.inferences.monte_carlo import MonteCarlo
  from edward.models import Empirical, RandomVariable
  from edward.util import check_latent_vars, copy
label_desc: Use image node_id 6 for calling the ReplicaExchangeMC obj's underlying member method code with example usage: obj._replica_ratio(replica_ratio, replica_sample) and returns: replica_ratio