Skip to content
proto

Policy

extendsProtocol
Policy()

Something that chooses actions and can be told an episode restarted.

The reset is what distinguishes this from a plain function. A world model does not act from the frame in front of it — it acts from a belief it has been updating since the episode began — so the driver has to be able to say "that was a different episode, start again". A stateless policy can implement it as a no-op.

Notes

Actions are expected in (-1, 1). Anything narrower is fine; the environment is what decides how they are scaled.

Examples

>>> import lucid
>>> from lucid.utils.rollout import Policy, RandomPolicy
>>> isinstance(RandomPolicy(2), Policy)
True

Used by 1

Constructors

1
dunder

__call__

→Tensor
__call__(observation: Tensor)

Choose an action.

Parameters

observationTensor
(C, H, W).

Returns

Tensor

(action_dim,) in (-1, 1).

Instance methods

1
fn

reset

→None
reset()

Forget whatever the previous episode left behind.