class_docstr: Stack previous four frames (must be applied to Gym env, not our envs).
class_docstr_tok: ["Stack","previous","four","frames","(","must","be","applied","to","Gym","env",",","not","our","envs",")","."]
code: def __init__(self, env: gym.Env):
      super(FrameStack4, self).__init__(env)
      self._env = env
      self._frames = collections.deque(maxlen=FrameStack4.STACK_SIZE)
      space = self._env.observation_space
      if space is None:
          raise ValueError("Observation space not initialized.")
      shape = space.shape[0:2] + (FrameStack4.STACK_SIZE,)
      self.observation_space = gym.spaces.Box(
          low=0, high=255, shape=shape, dtype=np.uint8
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import Any, Text
  import gym
  import numpy
  from tf_agents.environments import py_environment
  from tf_agents.environments import wrappers
  from tf_agents.trajectories import time_step
label_desc: Use image node_id 1 to create a new FrameStack4 object from inherited base classes: gym with example: obj = FrameStack4(env)