TensorDictBase.add#
- TensorDictBase.add_(other: TensorCollection | Tensor | float, *, alpha: float | None = None) Self#
Adds
other, scaled byalpha, to every leaf in place and returnsself.The in-place version of
add(), 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 add, paired with the leaves as in
add().- Keyword Arguments:
alpha (Number, optional) – the multiplier for
other. Defaults toNone, which addsotheras it is.
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.