Skip to content
class

Episode

extendsNamedTuple
Episode()

One complete trajectory, laid out for the replay buffer.

Attributes

observationsTensor
(T, C, H, W).
actionsTensor
(T, action_dim) — the action taken into each step, so actions[t] produced observations[t]. This is the alignment the world models expect.
rewardsTensor
(T,).
discountsTensor
(T,), 0 where the episode terminated and 1 everywhere else — including where it was merely truncated. Feeds pcont; ignored by models that hold the discount constant.

Notes

The first action is a zero vector: there is no action before the first observation, and the recurrence needs something of the right shape to start from.

Used by 3

Properties

1
prop

num_steps

→int
num_steps: int

Number of transitions in the episode (observations.shape[0]).

A named accessor rather than __len__: the record unpacks into four fields, so len has to stay four for _replace / _make / copy to keep working.