parameters: (self, player)
return_statement: return loss_advantages
docstring: Compute the loss on sampled transitions and perform a Q-network update.
  
      If there are not enough elements in the buffer, no loss is computed and
      `None` is returned instead.
  
      Args:
        player: (int) player index.
      Returns:
        The average loss over the advantage network.
docstring_summary: Compute the loss on sampled transitions and perform a Q-network update.
docstring_tokens: Compute the loss on sampled transitions and perform a Q - network update .
function: def _learn_advantage_network(self, player):
      """Compute the loss on sampled transitions and perform a Q-network update.
  
      If there are not enough elements in the buffer, no loss is computed and
      `None` is returned instead.
  
      Args:
        player: (int) player index.
      Returns:
        The average loss over the advantage network.
      """
      for _ in range(self._advantage_network_train_steps):
        if self._batch_size_advantage:
          if self._batch_size_advantage > len(self._advantage_memories[player]):
            ## Skip if there aren't enough samples
            return None
          samples = self._advantage_memories[player].sample(
              self._batch_size_advantage)
        else:
          samples = self._advantage_memories[player]
        info_states = []
        advantages = []
        iterations = []
        for s in samples:
          info_states.append(s.info_state)
          advantages.append(s.advantage)
          iterations.append([s.iteration])
        # Ensure some samples have been gathered.
        if not info_states:
          return None
  
        loss_advantages, _ = self._session.run(
            [self._loss_advantages[player], self._learn_step_advantages[player]],
            feed_dict={
                self._info_state_ph: np.array(info_states),
                self._advantage_ph[player]: np.array(advantages),
                self._iter_ph: np.array(iterations),
            })
      return loss_advantages
function_tokens: def _learn_advantage_network ( self , player ) : for _ in range ( self . _advantage_network_train_steps ) : if self . _batch_size_advantage : if self . _batch_size_advantage > len ( self . _advantage_memories [ player ] ) : ## Skip if there aren't enough samples return None samples = self . _advantage_memories [ player ] . sample ( self . _batch_size_advantage ) else : samples = self . _advantage_memories [ player ] info_states = [ ] advantages = [ ] iterations = [ ] for s in samples : info_states . append ( s . info_state ) advantages . append ( s . advantage ) iterations . append ( [ s . iteration ] ) # Ensure some samples have been gathered. if not info_states : return None loss_advantages , _ = self . _session . run ( [ self . _loss_advantages [ player ] , self . _learn_step_advantages [ player ] ] , feed_dict = { self . _info_state_ph : np . array ( info_states ) , self . _advantage_ph [ player ] : np . array ( advantages ) , self . _iter_ph : np . array ( iterations ) , } ) return loss_advantages