(self, action, state)
Takes a step in the environment.

    Args:
      action: An action tensor suitable for the underlying environment.
      state: The environment state from the last step or initial state.

    Returns:
      A tuple of (`StepOutput`, environment state). The environment state should
      be passed in to the next invocation of `step` and should not be used in
      any other way. On episode end (i.e. `done` is True), the returned reward
      should be included in the sum of rewards for the ending episode and not
      part of the next episode.
Takes a step in the environment.
Takes a step in the environment .
def step(self, action, state):
    """Takes a step in the environment.

    Args:
      action: An action tensor suitable for the underlying environment.
      state: The environment state from the last step or initial state.

    Returns:
      A tuple of (`StepOutput`, environment state). The environment state should
      be passed in to the next invocation of `step` and should not be used in
      any other way. On episode end (i.e. `done` is True), the returned reward
      should be included in the sum of rewards for the ending episode and not
      part of the next episode.
    """
    with tf.name_scope('flow_environment_step'):
      flow, info = nest.map_structure(tf.convert_to_tensor, state)

      # Make sure the previous step has been executed before running the next
      # step.
      with tf.control_dependencies([flow]):
        reward, done, observation = self._env.step(action)

      with tf.control_dependencies(nest.flatten(observation)):
        new_flow = tf.add(flow, 1)

      # When done, include the reward in the output info but not in the
      # state for the next step.
      new_info = StepOutputInfo(info.episode_return + reward,
                                info.episode_step + 1)
      new_state = new_flow, nest.map_structure(
          lambda a, b: tf.where(done, a, b),
          StepOutputInfo(tf.constant(0.), tf.constant(0)),
          new_info)

      output = StepOutput(reward, new_info, done, observation)
      return output, new_state
def step ( self , action , state ) : with tf . name_scope ( 'flow_environment_step' ) : flow , info = nest . map_structure ( tf . convert_to_tensor , state ) # Make sure the previous step has been executed before running the next # step. with tf . control_dependencies ( [ flow ] ) : reward , done , observation = self . _env . step ( action ) with tf . control_dependencies ( nest . flatten ( observation ) ) : new_flow = tf . add ( flow , 1 ) # When done, include the reward in the output info but not in the # state for the next step. new_info = StepOutputInfo ( info . episode_return + reward , info . episode_step + 1 ) new_state = new_flow , nest . map_structure ( lambda a , b : tf . where ( done , a , b ) , StepOutputInfo ( tf . constant ( 0. ) , tf . constant ( 0 ) ) , new_info ) output = StepOutput ( reward , new_info , done , observation ) return output , new_state