class_docstr: Deep Deterministic Policy Gradients.
  
  This can be used as SVG(0) by specifying a Gaussian policy instead of a
  deterministic policy.
  
  Args:
      model (DDPGModel): DDPG model that contains both a policy and a
          Q-function
      actor_optimizer (Optimizer): Optimizer setup with the policy
      critic_optimizer (Optimizer): Optimizer setup with the Q-function
      replay_buffer (ReplayBuffer): Replay buffer
      gamma (float): Discount factor
      explorer (Explorer): Explorer that specifies an exploration strategy.
      gpu (int): GPU device id if not None nor negative.
      replay_start_size (int): if the replay buffer's size is less than
          replay_start_size, skip update
      minibatch_size (int): Minibatch size
      update_interval (int): Model update interval in step
      target_update_interval (int): Target model update interval in step
      phi (callable): Feature extractor applied to observations
      target_update_method (str): 'hard' or 'soft'.
      soft_update_tau (float): Tau of soft target update.
      n_times_update (int): Number of repetition of update
      average_q_decay (float): Decay rate of average Q, only used for
          recording statistics
      average_loss_decay (float): Decay rate of average loss, only used for
          recording statistics
      batch_accumulator (str): 'mean' or 'sum'
      episodic_update (bool): Use full episodes for update if set True
      episodic_update_len (int or None): Subsequences of this length are used
          for update if set int and episodic_update=True
      logger (Logger): Logger used
      batch_states (callable): method which makes a batch of observations.
          default is `chainerrl.misc.batch_states.batch_states`
      burnin_action_func (callable or None): If not None, this callable
          object is used to select actions before the model is updated
          one or more times during training.
docstr: Compute loss for actor.
  
  Preconditions:
    q_function must have seen up to s_{t-1} and s_{t-1}.
    policy must have seen up to s_{t-1}.
  Postconditions:
    q_function must have seen up to s_t and s_t.
    policy must have seen up to s_t.
docstr_tok: ["Compute","loss","for","actor",".","Preconditions",":","q_function","must","have","seen","up","to","s_","{","t-1","}","and","s_","{","t-1","}",".","policy","must","have","seen","up","to","s_","{","t-1","}",".","Postconditions",":","q_function","must","have","seen","up","to","s_t","and","s_t",".","policy","must","have","seen","up","to","s_t","."]
code: def compute_actor_loss(self, batch):
      """Compute loss for actor.
  
      Preconditions:
        q_function must have seen up to s_{t-1} and s_{t-1}.
        policy must have seen up to s_{t-1}.
      Postconditions:
        q_function must have seen up to s_t and s_t.
        policy must have seen up to s_t.
      """
  
      batch_state = batch["state"]
      batch_action = batch["action"]
      batch_size = len(batch_action)
  
      # Estimated policy observes s_t
      onpolicy_actions = self.policy(batch_state).sample()
  
      # Q(s_t, mu(s_t)) is evaluated.
      # This should not affect the internal state of Q.
      with state_kept(self.q_function):
          q = self.q_function(batch_state, onpolicy_actions)
  
      # Estimated Q-function observes s_t and a_t
      if isinstance(self.q_function, Recurrent):
          self.q_function.update_state(batch_state, batch_action)
  
      # Avoid the numpy #9165 bug (see also: chainer #2744)
      q = q[:, :]
  
      # Since we want to maximize Q, loss is negation of Q
      loss = -F.sum(q) / batch_size
  
      # Update stats
      self.average_actor_loss *= self.average_loss_decay
      self.average_actor_loss += (1 - self.average_loss_decay) * float(
          loss.array
      )
      return loss
  
imports: import copy
  from logging import getLogger
  import chainer
  from chainer import cuda
  import chainer.functions
  from chainerrl.agent import AttributeSavingMixin
  from chainerrl.agent import BatchAgent
  from chainerrl.misc.batch_states import batch_states
  from chainerrl.misc.copy_param import synchronize_parameters
  from chainerrl.recurrent import Recurrent
  from chainerrl.recurrent import RecurrentChainMixin
  from chainerrl.recurrent import state_kept
  from chainerrl.replay_buffer import batch_experiences
  from chainerrl.replay_buffer import ReplayUpdater
label_desc: Use image node_id 4 for calling the DDPG obj's underlying member method code with example usage: obj.compute_actor_loss(batch) and returns: loss