remove_gradients#

metatensor.remove_gradients(tensor: TensorMap, remove: List[str] | None = None) TensorMap[source]#

Remove some or all of the gradients from a TensorMap.

Parameters:
  • tensor (TensorMap) – input TensorMap, with gradients to remove

  • remove (List[str] | None) – which gradients should be excluded from the new tensor map. If this is set to None (this is the default), all the gradients will be removed.

Returns:

A new tensormap without the gradients.

Return type:

TensorMap