equal¶
- metatensor.equal(tensor_1: TensorMap, tensor_2: TensorMap) bool [source]¶
Compare two
TensorMap
.This function returns
True
if the two tensors have the same keys (potentially in different order) and all theTensorBlock
have the same (and in the same order) samples, components, properties, and their their values are strictly equal.The
TensorMap
contains gradient data, then this function only returnsTrue
if all the gradients also have the same samples, components, properties and their their values are strictly equal.In practice this function calls
equal_raise()
, returningTrue
if no exception is raised,False
otherwise.
- metatensor.equal_raise(tensor_1: TensorMap, tensor_2: TensorMap) None [source]¶
Compare two
TensorMap
, raisingNotEqualError
if they are not the same.The message associated with the exception will contain more information on where the two
TensorMap
differ. Seeequal()
for more information on whichTensorMap
are considered equal.- Raises:
metatensor.NotEqualError
if 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
True
if the twoTensorBlock
have the same samples, components, properties and their values are strictly equal.If the
TensorBlock
contains 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()
, returningTrue
if no exception is raised,False
otherwise.- 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
, raisingmetatensor.NotEqualError
if they are not the same.The message associated with the exception will contain more information on where the two
TensorBlock
differ. Seeequal_block()
for more information on whichTensorBlock
are considered equal.- Raises:
metatensor.NotEqualError
if the blocks are different- Parameters:
block_1 (TensorBlock) – first
TensorBlock
.block_2 (TensorBlock) – second
TensorBlock
.
- Return type:
None