pow#

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

Return a new TensorMap with the same metadata of A and the values being the element-wise B-power of A.values.

B can only be a scalar. If gradients are present in A the gradient of the resulting TensorMap are given by the standard formula:

\[\nabla(A ^ B) = B* \nabla A * A^{(B-1)}\]
Parameters:
  • A (TensorMap) – TensorMap to be elevated at the power of B.

  • B (float | int) – The power to which we want to elevate A. Parameter can only be a scalar or something that can be converted to a scalar.

Returns:

New TensorMap with the same metadata as A.

Return type:

TensorMap