nip.utils.tensordict.tensordict_add

Contents

nip.utils.tensordict.tensordict_add#

nip.utils.tensordict.tensordict_add(td1: TensorDictBase, td2: TensorDictBase, *, inplace=False) TensorDictBase[source]#

Add two tensordicts together.

Parameters:
  • td1 (TensorDictBase) – The first tensordict

  • td2 (TensorDictBase) – The second tensordict

  • inplace (bool, default=False) – Whether to modify the first tensordict in place. Otherwise the first tensordict is cloned before adding the second tensordict.

Returns:

td_sum (TensorDictBase) – The sum of the two tensordicts