Skip to content
data

DreamerV3BehaviorOutput

extendsModelOutput
DreamerV3BehaviorOutput(actor_loss: Tensor, value_loss: Tensor, lambda_return: Tensor, return_scale: Tensor, entropy: Tensor, imagined_reward: Tensor, imagined_value: Tensor, imagined_action: Tensor, imagined_discount: Tensor | None = None, replay_value_loss: Tensor | None = None)

What the imagination pass produces.

Attributes

actor_loss, value_lossTensor
Scalars, each for its own optimiser. value_loss already carries the replayed-trajectory term when one is configured.
lambda_returnTensor
The targets, (N, H), bootstrapped from the live critic.
return_scaleTensor
What the advantage was divided by — max(1, S), 0-d. Exposed because it is the number that decides whether the entropy bonus is currently doing anything.
entropyTensor
Mean policy entropy over the scored states.
imagined_reward, imagined_valueTensor
Along the imagined trajectory, (N, H + 1).
imagined_actionTensor
What the actor proposed, (N, H, action_dim).
imagined_discountTensor or None
Predicted continuation probability, (N, H + 1); None when the discount is held constant.
replay_value_lossTensor or None
The critic's term over the replayed trajectory, before its scale is applied; None when that term is switched off.

Examples

>>> import lucid
>>> from lucid.models import dreamer_v3_12m_world_model
>>> model = dreamer_v3_12m_world_model(action_dim=2, cnn_depth=2, stoch_size=3,
...     discrete=4, deter_size=8, hidden_size=8, actor_hidden=8,
...     value_hidden=8, reward_hidden=8, num_bins=5, horizon=3, pcont=False)
>>> out = model(lucid.randn((1, 4, 3, 64, 64)), lucid.randn((1, 4, 2)),
...             lucid.randn((1, 4)))
>>> out.behavior.lambda_return.shape
(4, 3)

Used by 1