code: def _update_target_log_prob(kernel, new_target_log_prob):
      """Replaces `target_log_prob_fn` of outermost `inner_kernel` of `kernel`."""
      kernel_stack = _make_kernel_stack(kernel)
      # Update to target_log_prob to `new_target_log_prob`.
      with deprecation.silence():
          prev_kernel = kernel_stack.pop()
          prev_kernel = prev_kernel.copy(
              target_log_prob_fn=new_target_log_prob
          )
  
          # Propagate the change upwards by reconstructing wrapper kernels.
          while kernel_stack:
              curr_kernel = kernel_stack.pop()
              updated_kernel = type(prev_kernel)(
                  **prev_kernel.parameters
              )
              curr_kernel = curr_kernel.copy(
                  inner_kernel=updated_kernel
              )
              prev_kernel = curr_kernel
          return prev_kernel
  
imports: import collections
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.mcmc import kernel
  from tensorflow_probability.python.mcmc.internal import util
  from tensorflow.python.util import deprecation
label_desc: Use image node_id 6 for calling a global function with example usage: _update_target_log_prob(kernel, new_target_log_prob) and returns: prev_kernel