d3rlpy.dataset.FrameStackTransitionPicker

class d3rlpy.dataset.FrameStackTransitionPicker(n_frames)[source]

Frame-stacking transition picker.

This class implements the frame-stacking logic. The observations are stacked with the last n_frames-1 frames. When index specifies timestep below n_frames, those frames are padded by zeros.

episode = Episode(
    observations=np.random.random((100, 1, 84, 84)),
    actions=np.random.random((100, 2)),
    rewards=np.random.random((100, 1)),
    terminated=False,
)

frame_stacking_picker = FrameStackTransitionPicker(n_frames=4)
transition = frame_stacking_picker(episode, 10)

transition.observation.shape == (4, 84, 84)
Parameters:

n_frames (int) – Number of frames to stack.

Methods

__call__(episode, index)[source]

Returns transition specified by index.

Parameters:
  • episode (EpisodeBase) – Episode.

  • index (int) – Index at the target transition.

Returns:

Transition.

Return type:

Transition