nip.utils.bugfix.Reward2GoTransform#
- class nip.utils.bugfix.Reward2GoTransform(gamma: float | Tensor | None = 1.0, in_keys: Sequence[NestedKey] | None = None, out_keys: Sequence[NestedKey] | None = None, done_key: NestedKey | None = 'done')[source]#
Calculates the reward to go based on the episode reward and a discount factor.
This is a fixed version of the
Reward2GoTransformclass from torchrl. The original version had a bug where the reward-to-go was reshaped rather than transposed.See
torchrl.envs.transforms.Reward2GoTransformfor more information.Methods Summary
_inv_apply_transform(reward, done)Attributes
ENV_ERRT_destinationcall_super_initcontainerReturns the env containing the transform.
dump_patchesin_keysin_keys_invinvertiblemissing_toleranceout_keysout_keys_invparentReturns the parent env of the transform.
trainingMethods