docstr: Stack k last frames.
docstr_tok: ["Stack","k","last","frames","."]
code: def __init__(self, env, k, obs_format="NHWC"):
      """Stack k last frames."""
      gym.Wrapper.__init__(self, env)
      self.k = k
      self.frames = deque([], maxlen=k)
      shp = env.observation_space.shape
      assert obs_format == "NHWC" or obs_format == "NCHW"
      self.obs_format = obs_format
      if obs_format == "NHWC":
          obs_shape = (shp[0], shp[1], k)
      else:
          obs_shape = (k, shp[0], shp[1])
  
      self.observation_space = spaces.Box(
          low=0,
          high=255,
          shape=obs_shape,
          dtype=env.observation_space.dtype,
      )
  
imports: import time
  import numpy
  from collections import deque
  import gym
  from gym import spaces
  from parl.env.compat_wrappers import CompatWrapper, is_gym_version_ge, V_NPRANDOM_CHANGED
  import cv2
label_desc: Use image node_id 1 to create a new FrameStack object from inherited base classes: gym with example: obj = FrameStack(env, k, obs_format)