code: def _make_replica_target_log_prob_fn(
      target_log_prob_fn,
      inverse_temperatures,
      untempered_log_prob_fn=None,
      tempered_log_prob_fn=None,
  ):
      """Helper which creates inner kernel target_log_prob_fn."""
  
      def _replica_target_log_prob(*x):
          if tempered_log_prob_fn is not None:
              tlp = tempered_log_prob_fn(*x)
          else:
              tlp = target_log_prob_fn(*x)
  
          log_prob = (
              tf.cast(
                  bu.left_justified_expand_dims_like(
                      inverse_temperatures, tlp
                  ),
                  dtype=tlp.dtype,
              )
              * tlp
          )
  
          if untempered_log_prob_fn is not None:
              log_prob = log_prob + untempered_log_prob_fn(*x)
  
          return log_prob
  
      return _replica_target_log_prob
  
imports: import collections
  import warnings
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import broadcast_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import unnest
  from tensorflow_probability.python.mcmc import kernel
  from tensorflow_probability.python.mcmc.internal import util
label_desc: Use image node_id 3 for calling a global function with example usage: _make_replica_target_log_prob_fn(target_log_prob_fn, inverse_temperatures, untempered_log_prob_fn, tempered_log_prob_fn) and returns: _replica_target_log_prob, log_prob