- class torchrl.objectives.DreamerValueLoss(*args, **kwargs)¶
Dreamer Value Loss.
Computes the loss of the dreamer value model. The value loss is computed between the predicted value and the lambda target.
value_model (TensorDictModule) – the value model.
value_loss (str, optional) – the loss to use for the value loss. Default:
discount_loss (bool, optional) – if
True, the loss is discounted with a gamma discount factor. Default: False.
gamma (float, optional) – the gamma discount factor. Default:
- forward(fake_data) Tensor ¶
It is designed to read an input TensorDict and return another tensordict with loss keys named “loss*”.
Splitting the loss in its component can then be used by the trainer to log the various loss values throughout training. Other scalars present in the output tensordict will be logged too.
tensordict – an input tensordict with the values required to compute the loss.
A new tensordict with no batch dimension containing various loss scalars which will be named “loss*”. It is essential that the losses are returned with this name as they will be read by the trainer before backpropagation.