class_docstr: Core to unroll online and target policies and Q functions at once.
  
  A core that runs online and target policies and Q functions. This can be more
  efficient if the core needs to be unrolled across time and called many times.
class_docstr_tok: ["Core","to","unroll","online","and","target","policies","and","Q","functions","at","once",".","A","core","that","runs","online","and","target","policies","and","Q","functions",".","This","can","be","more","efficient","if","the","core","needs","to","be","unrolled","across","time","and","called","many","times","."]
code: def __call__(self, input_obs_and_action: Tuple[tf.Tensor, tf.Tensor]):
      (obs, action) = input_obs_and_action
      online_pi_dist = self._online_pi(obs)
      target_pi_dist = self._target_pi(obs)
  
      online_samples = online_pi_dist.sample(self._num_samples)
      target_samples = target_pi_dist.sample(self._num_samples)
      target_log_probs_behavior_actions = target_pi_dist.log_prob(
          action
      )
  
      online_log_probs = online_pi_dist.log_prob(
          tf.stop_gradient(online_samples)
      )
  
      online_q_out = self._online_q(obs, action)
      target_q_out = self._target_q(obs, action)
  
      output_list = [
          online_samples,
          target_samples,
          target_log_probs_behavior_actions,
          online_log_probs,
          online_q_out,
          target_q_out,
      ]
  
      if self._online_prior is not None:
          prior_dist = self._online_prior(obs)
          target_prior_dist = self._target_prior(obs)
          analytic_kl_divergence = online_pi_dist.kl_divergence(
              prior_dist
          )
          analytic_kl_to_target = online_pi_dist.kl_divergence(
              target_prior_dist
          )
  
          output_list += [analytic_kl_divergence, analytic_kl_to_target]
      output = self._output_tuple(*output_list)
      return output
  
file_path: acme/acme/agents/tf/svg0_prior/utils.py
imports: import collections
  from typing import Tuple, Optional, Dict, Iterable
  from acme import types
  from acme.tf import utils
  import sonnet
  import tensorflow
  import tree
label_desc: Use image node_id 2 for calling the OnlineTargetPiQ obj's underlying member method code with example usage: obj.__call__(input_obs_and_action) and returns: output