is_contiguous

metatensor.is_contiguous(tensor: TensorMap) bool[source]

Checks whether all values arrays and gradients values arrays (if present) in all TensorBlock of an input TensorMap are contiguous.

Note that arrays of Labels objects are not checked for contiguity.

Parameters:

tensor (TensorMap) – the input TensorMap.

Returns:

bool, true if all values arrays contiguous, false otherwise.

Return type:

bool

metatensor.is_contiguous_block(block: TensorBlock) bool[source]

Checks whether the values array and gradients values arrays (if present) of an input TensorBlock are contiguous.

Note that arrays of Labels objects are not checked for contiguity.

Parameters:

block (TensorBlock) – the input TensorBlock.

Returns:

bool, true if all values arrays contiguous, false otherwise.

Return type:

bool