equal#
- metatensor.equal(tensor_1: TensorMap, tensor_2: TensorMap) bool[source]#
- Compare two - TensorMap.- This function returns - Trueif the two tensors have the same keys (potentially in different order) and all the- TensorBlockhave the same (and in the same order) samples, components, properties, and their their values are strictly equal.- The - TensorMapcontains gradient data, then this function only returns- Trueif all the gradients also have the same samples, components, properties and their their values are strictly equal.- In practice this function calls - equal_raise(), returning- Trueif no exception is raised,- Falseotherwise.
- metatensor.equal_raise(tensor_1: TensorMap, tensor_2: TensorMap) None[source]#
- Compare two - TensorMap, raising- NotEqualErrorif they are not the same.- The message associated with the exception will contain more information on where the two - TensorMapdiffer. See- equal()for more information on which- TensorMapare considered equal.- Raises:
- metatensor.NotEqualErrorif the blocks are different
- Parameters:
- Return type:
- None 
 
- metatensor.equal_block(block_1: TensorBlock, block_2: TensorBlock) bool[source]#
- Compare two - TensorBlock.- This function returns - Trueif the two- TensorBlockhave the same samples, components, properties and their values are strictly equal.- If the - TensorBlockcontains gradients, then the gradient must also have same (and in the same order) samples, components, properties and their values are strictly equal.- In practice this function calls - equal_block_raise(), returning- Trueif no exception is raised,- Falseotherwise.- Parameters:
- block_1 (TensorBlock) – first - TensorBlock.
- block_2 (TensorBlock) – second - TensorBlock.
 
- Return type:
 
- metatensor.equal_block_raise(block_1: TensorBlock, block_2: TensorBlock) None[source]#
- Compare two - TensorBlock, raising- metatensor.NotEqualErrorif they are not the same.- The message associated with the exception will contain more information on where the two - TensorBlockdiffer. See- equal_block()for more information on which- TensorBlockare considered equal.- Raises:
- metatensor.NotEqualErrorif the blocks are different
- Parameters:
- block_1 (TensorBlock) – first - TensorBlock.
- block_2 (TensorBlock) – second - TensorBlock.
 
- Return type:
- None