code: def _stack_obs_ref(enc_obs, dones, nsteps):
      nenv = enc_obs.shape[0]
      nstack = enc_obs.shape[1] - nsteps
      nh, nw, nc = enc_obs.shape[2:]
      obs_dtype = enc_obs.dtype
      obs_shape = (nh, nw, nc * nstack)
  
      mask = np.empty(
          [nsteps + nstack - 1, nenv, 1, 1, 1], dtype=np.float32
      )
      obs = np.zeros(
          [nstack, nsteps + nstack, nenv, nh, nw, nc], dtype=obs_dtype
      )
      x = np.reshape(
          enc_obs, [nenv, nsteps + nstack, nh, nw, nc]
      ).swapaxes(
          1, 0
      )  # [nsteps + nstack, nenv, nh, nw, nc]
  
      mask[nstack - 1 :] = np.reshape(
          1.0 - dones, [nenv, nsteps, 1, 1, 1]
      ).swapaxes(
          1, 0
      )  # keep
      mask[: nstack - 1] = 1.0
  
      # y = np.reshape(1 - dones, [nenvs, nsteps, 1, 1, 1])
      for i in range(nstack):
          obs[-(i + 1), i:] = x
          # obs[:,i:,:,:,-(i+1),:] = x
          x = x[:-1] * mask
          mask = mask[1:]
  
      return np.reshape(
          obs[:, (nstack - 1) :].transpose((2, 1, 3, 4, 0, 5)),
          (nenv, (nsteps + 1)) + obs_shape,
      )
  
file_path: baselines/baselines/acer/buffer.py
imports: import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _stack_obs_ref(enc_obs, dones, nsteps) and returns: np