parameters: (self, time_step, is_evaluation=False)
return_statement: return rl_agent.StepOutput(action=action, probs=probs)
docstring: Returns the action to be taken and updates the network if needed.
  
      Args:
        time_step: an instance of rl_environment.TimeStep.
        is_evaluation: bool, whether this is a training or evaluation call.
  
      Returns:
        A `rl_agent.StepOutput` containing the action probs and chosen action.
docstring_summary: Returns the action to be taken and updates the network if needed.
docstring_tokens: Returns the action to be taken and updates the network if needed .
function: def step(self, time_step, is_evaluation=False):
      """Returns the action to be taken and updates the network if needed.
  
      Args:
        time_step: an instance of rl_environment.TimeStep.
        is_evaluation: bool, whether this is a training or evaluation call.
  
      Returns:
        A `rl_agent.StepOutput` containing the action probs and chosen action.
      """
      # Act step: don't act at terminal info states or if its not our turn.
      if (not time_step.last()) and (
          time_step.is_simultaneous_move() or
          self.player_id == time_step.current_player()):
        info_state = time_step.observations["info_state"][self.player_id]
        legal_actions = time_step.observations["legal_actions"][self.player_id]
        action, probs = self._act(info_state, legal_actions)
      else:
        action = None
        probs = []
  
      if not is_evaluation:
        self._step_counter += 1
  
        # Add data points to current episode buffer.
        if self._prev_time_step:
          self._add_transition(time_step)
  
        # Episode done, add to dataset and maybe learn.
        if time_step.last():
          self._add_episode_data_to_dataset()
          self._episode_counter += 1
  
          if len(self._dataset["returns"]) >= self._batch_size:
            self._critic_update()
            self._num_learn_steps += 1
            if self._num_learn_steps % self._num_critic_before_pi == 0:
              self._pi_update()
            self._dataset = collections.defaultdict(list)
  
          self._prev_time_step = None
          self._prev_action = None
          return
        else:
          self._prev_time_step = time_step
          self._prev_action = action
  
      return rl_agent.StepOutput(action=action, probs=probs)
function_tokens: def step ( self , time_step , is_evaluation = False ) : # Act step: don't act at terminal info states or if its not our turn. if ( not time_step . last ( ) ) and ( time_step . is_simultaneous_move ( ) or self . player_id == time_step . current_player ( ) ) : info_state = time_step . observations [ "info_state" ] [ self . player_id ] legal_actions = time_step . observations [ "legal_actions" ] [ self . player_id ] action , probs = self . _act ( info_state , legal_actions ) else : action = None probs = [ ] if not is_evaluation : self . _step_counter += 1 # Add data points to current episode buffer. if self . _prev_time_step : self . _add_transition ( time_step ) # Episode done, add to dataset and maybe learn. if time_step . last ( ) : self . _add_episode_data_to_dataset ( ) self . _episode_counter += 1 if len ( self . _dataset [ "returns" ] ) >= self . _batch_size : self . _critic_update ( ) self . _num_learn_steps += 1 if self . _num_learn_steps % self . _num_critic_before_pi == 0 : self . _pi_update ( ) self . _dataset = collections . defaultdict ( list ) self . _prev_time_step = None self . _prev_action = None return else : self . _prev_time_step = time_step self . _prev_action = action return rl_agent . StepOutput ( action = action , probs = probs )