class_docstr: Wrapper that stacks observations along a new final axis.
class_docstr_tok: ["Wrapper","that","stacks","observations","along","a","new","final","axis","."]
docstr: Initializes a new FrameStackingWrapper.
  
  Args:
    environment: Environment.
    num_frames: Number frames to stack.
    flatten: Whether to flatten the channel and stack dimensions together.
docstr_tok: ["Initializes","a","new","FrameStackingWrapper",".","Args",":","environment",":","Environment",".","num_frames",":","Number","frames","to","stack",".","flatten",":","Whether","to","flatten","the","channel","and","stack","dimensions","together","."]
code: def __init__(
      self,
      environment: dm_env.Environment,
      num_frames: int = 4,
      flatten: bool = False,
  ):
      """Initializes a new FrameStackingWrapper.
  
      Args:
        environment: Environment.
        num_frames: Number frames to stack.
        flatten: Whether to flatten the channel and stack dimensions together.
      """
      self._environment = environment
      original_spec = self._environment.observation_spec()
      self._stackers = tree.map_structure(
          lambda _: FrameStacker(
              num_frames=num_frames, flatten=flatten
          ),
          self._environment.observation_spec(),
      )
      self._observation_spec = tree.map_structure(
          lambda stacker, spec: stacker.update_spec(spec),
          self._stackers,
          original_spec,
      )
  
file_path: acme/acme/wrappers/frame_stacking.py
imports: import collections
  from acme import types
  from acme.wrappers import base
  import dm_env
  from dm_env import specs
  import numpy
  import tree
label_desc: Use image node_id 1 to create a new FrameStackingWrapper object from inherited base classes: base with example: obj = FrameStackingWrapper(environment, num_frames, flatten)