class_docstr: Simple class for frame-stacking observations.
class_docstr_tok: ["Simple","class","for","frame-stacking","observations","."]
docstr: Append frame to stack and return the stack.
docstr_tok: ["Append","frame","to","stack","and","return","the","stack","."]
code: def step(self, frame: np.ndarray) -> np.ndarray:
      """Append frame to stack and return the stack."""
      if not self._stack:
          # Fill stack with blank frames if empty.
          self._stack.extend(
              [np.zeros_like(frame)] * (self._num_frames - 1)
          )
      self._stack.append(frame)
      stacked_frames = np.stack(self._stack, axis=-1)
  
      if not self._flatten:
          return stacked_frames
      else:
          new_shape = stacked_frames.shape[:-2] + (-1,)
          return stacked_frames.reshape(*new_shape)
  
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 4 for calling the FrameStacker obj's underlying member method code with example usage: obj.step(frame) and returns: stacked_frames, stacked_frames