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: A (TensorMap) – First TensorMap for the addition. B (int | float | TensorMap) – Second instance for the addition. Parameter can be a scalar or a TensorMap. In the latter case B must have the same metadata of A. Returns: New TensorMap with the same metadata as A. Return type: TensorMap