add

metatensor.add(A: TensorMap, B: int | float | TensorMap) TensorMap[source]

Return a new TensorMap with the values being the sum of A and B.

If B is a TensorMap it has to have the same metadata as A.

If gradients are present in A:

  • B is a scalar:

    (A+B)=A
  • B is a TensorMap with the same metadata of A:

    (A+B)=A+B
Parameters:
Returns:

New TensorMap with the same metadata as A.

Return type:

TensorMap