docstr: Warp frames to 84x84 as done in the Nature paper and later work.
  
  If the environment uses dictionary observations, `dict_space_key` can be specified which indicates which
  observation should be warped.
docstr_tok: ["Warp","frames","to","84x84","as","done","in","the","Nature","paper","and","later","work",".","If","the","environment","uses","dictionary","observations",",","`","dict_space_key","`","can","be","specified","which","indicates","which","observation","should","be","warped","."]
code: def __init__(
      self,
      env,
      width=84,
      height=84,
      grayscale=True,
      dict_space_key=None,
  ):
      """
      Warp frames to 84x84 as done in the Nature paper and later work.
  
      If the environment uses dictionary observations, `dict_space_key` can be specified which indicates which
      observation should be warped.
      """
      super().__init__(env)
      self._width = width
      self._height = height
      self._grayscale = grayscale
      self._key = dict_space_key
      if self._grayscale:
          num_colors = 1
      else:
          num_colors = 3
  
      new_space = gym.spaces.Box(
          low=0,
          high=255,
          shape=(self._height, self._width, num_colors),
          dtype=np.uint8,
      )
      if self._key is None:
          original_space = self.observation_space
          self.observation_space = new_space
      else:
          original_space = self.observation_space.spaces[self._key]
          self.observation_space.spaces[self._key] = new_space
      assert (
          original_space.dtype == np.uint8
          and len(original_space.shape) == 3
      )
  
imports: import numpy
  import os
  from collections import deque
  import gym
  from gym import spaces
  import cv2
  from .wrappers import TimeLimit
label_desc: Use image node_id 1 to create a new WarpFrame object from inherited base classes: gym with example: obj = WarpFrame(env, width, height, grayscale, dict_space_key)