class_docstr: Abstract base class for Python RL environments.
  
  Observations and valid actions are described with `ArraySpec`s, defined in
  the `specs` module.
  
  If the environment can run multiple steps at the same time and take a batched
  set of actions and return a batched set of observations, it should overwrite
  the property batched to True.
  
  Environments are assumed to auto reset once they reach the end of the episode,
  if prefer that the base class handle auto_reset set `handle_auto_reset=True`.
class_docstr_tok: ["Abstract","base","class","for","Python","RL","environments",".","Observations","and","valid","actions","are","described","with","`","ArraySpec","`","s",",","defined","in","the","`","specs","`","module",".","If","the","environment","can","run","multiple","steps","at","the","same","time","and","take","a","batched","set","of","actions","and","return","a","batched","set","of","observations",",","it","should","overwrite","the","property","batched","to","True",".","Environments","are","assumed","to","auto","reset","once","they","reach","the","end","of","the","episode",",","if","prefer","that","the","base","class","handle","auto_reset","set","`","handle_auto_reset=True","`","."]
docstr: Updates the environment according to the action and returns a `TimeStep`.
  
  If the environment returned a `TimeStep` with `StepType.LAST` at the
  previous step the implementation of `_step` in the environment should call
  `reset` to start a new sequence and ignore `action`.
  
  This method will start a new sequence if called after the environment
  has been constructed and `reset` has not been called. In this case
  `action` will be ignored.
  
  If `should_reset(current_time_step)` is True, then this method will `reset`
  by itself. In this case `action` will be ignored.
  
  Note: Subclasses cannot override this directly. Subclasses implement
  _step() which will be called by this method. The output of _step() will be
  cached and made available through current_time_step().
  
  Args:
    action: A NumPy array, or a nested dict, list or tuple of arrays
      corresponding to `action_spec()`.
  
  Returns:
    A `TimeStep` namedtuple containing:
      step_type: A `StepType` value.
      reward: A NumPy array, reward value for this timestep.
      discount: A NumPy array, discount in the range [0, 1].
      observation: A NumPy array, or a nested dict, list or tuple of arrays
        corresponding to `observation_spec()`.
docstr_tok: ["Updates","the","environment","according","to","the","action","and","returns","a","`","TimeStep","`",".","If","the","environment","returned","a","`","TimeStep","`","with","`","StepType.LAST","`","at","the","previous","step","the","implementation","of","`","_step","`","in","the","environment","should","call","`","reset","`","to","start","a","new","sequence","and","ignore","`","action","`",".","This","method","will","start","a","new","sequence","if","called","after","the","environment","has","been","constructed","and","`","reset","`","has","not","been","called",".","In","this","case","`","action","`","will","be","ignored",".","If","`","should_reset","(","current_time_step",")","`","is","True",",","then","this","method","will","`","reset","`","by","itself",".","In","this","case","`","action","`","will","be","ignored",".","Note",":","Subclasses","can","not","override","this","directly",".","Subclasses","implement","_step","(",")","which","will","be","called","by","this","method",".","The","output","of","_step","(",")","will","be","cached","and","made","available","through","current_time_step","(",")",".","Args",":","action",":","A","NumPy","array",",","or","a","nested","dict",",","list","or","tuple","of","arrays","corresponding","to","`","action_spec","(",")","`",".","Returns",":","A","`","TimeStep","`","namedtuple","containing",":","step_type",":","A","`","StepType","`","value",".","reward",":","A","NumPy","array",",","reward","value","for","this","timestep",".","discount",":","A","NumPy","array",",","discount","in","the","range","[","0",",","1","]",".","observation",":","A","NumPy","array",",","or","a","nested","dict",",","list","or","tuple","of","arrays","corresponding","to","`","observation_spec","(",")","`","."]
code: def step(self, action: types.NestedArray) -> ts.TimeStep:
      """Updates the environment according to the action and returns a `TimeStep`.
  
      If the environment returned a `TimeStep` with `StepType.LAST` at the
      previous step the implementation of `_step` in the environment should call
      `reset` to start a new sequence and ignore `action`.
  
      This method will start a new sequence if called after the environment
      has been constructed and `reset` has not been called. In this case
      `action` will be ignored.
  
      If `should_reset(current_time_step)` is True, then this method will `reset`
      by itself. In this case `action` will be ignored.
  
      Note: Subclasses cannot override this directly. Subclasses implement
      _step() which will be called by this method. The output of _step() will be
      cached and made available through current_time_step().
  
      Args:
        action: A NumPy array, or a nested dict, list or tuple of arrays
          corresponding to `action_spec()`.
  
      Returns:
        A `TimeStep` namedtuple containing:
          step_type: A `StepType` value.
          reward: A NumPy array, reward value for this timestep.
          discount: A NumPy array, discount in the range [0, 1].
          observation: A NumPy array, or a nested dict, list or tuple of arrays
            corresponding to `observation_spec()`.
      """
      if self._current_time_step is None or self.should_reset(
          self._current_time_step
      ):
          return self.reset()
  
      self._current_time_step = self._step(action)
      return self._current_time_step
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  from typing import Any, Optional, Text
  import numpy
  import six
  from tf_agents.specs import array_spec
  from tf_agents.trajectories import time_step
  from tf_agents.typing import types
  from tf_agents.utils import common
label_desc: Use image node_id 12 for calling the PyEnvironment obj's underlying member method code with example usage: obj.step(action) and returns: self, self