TensorDictBase.sub#
- TensorDictBase.sub_(other: TensorDictBase | Tensor | float, alpha: float | None = None)#
Subtracts
other, scaled byalpha, from every leaf in place and returnsself.The in-place version of
sub(), called bytd -= other. It has nodefault: a tensordictothermust have every key of the tensordict, and its other keys are ignored.- Parameters:
other (TensorDictBase, Tensor or Number) – the value to subtract, paired with the leaves as in
sub().alpha (Number, optional) – the multiplier for
other. Defaults toNone, which subtractsotheras it is.
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.