requires_grad#
- metatensor.requires_grad(tensor: TensorMap, requires_grad: bool = True) TensorMap[source]#
- Set - requires_gradon all arrays (blocks and gradients of blocks) in this- tensorto the provided value.- This is mainly intended for torch arrays, and will warn if trying to set - requires_grad=Truewith numpy arrays.
- metatensor.requires_grad_block(block: TensorBlock, requires_grad: bool = True) TensorBlock[source]#
- Set - requires_gradon the values and all gradients in this- blockto the provided value.- This is mainly intended for torch arrays, and will warn if trying to set - requires_grad=Truewith numpy arrays.- Parameters:
- block (TensorBlock) – - TensorBlockto modify
- requires_grad (bool) – new value for - requires_grad
 
- Return type: