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 theTensorBlockhave 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 returnsTrueif all the gradients also have the same samples, components, properties and their their values are strictly equal.In practice this function calls
equal_raise(), returningTrueif no exception is raised,Falseotherwise.
- metatensor.equal_raise(tensor_1: TensorMap, tensor_2: TensorMap) None[source]¶
Compare two
TensorMap, raisingNotEqualErrorif they are not the same.The message associated with the exception will contain more information on where the two
TensorMapdiffer. Seeequal()for more information on whichTensorMapare 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 twoTensorBlockhave 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(), returningTrueif 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, raisingmetatensor.NotEqualErrorif they are not the same.The message associated with the exception will contain more information on where the two
TensorBlockdiffer. Seeequal_block()for more information on whichTensorBlockare considered equal.- Raises:
metatensor.NotEqualErrorif the blocks are different- Parameters:
block_1 (TensorBlock) – first
TensorBlock.block_2 (TensorBlock) – second
TensorBlock.
- Return type:
None