drop_blocks¶
- metatensor.drop_blocks(tensor: TensorMap, keys: Labels, copy: bool = False) TensorMap[source]¶
Drop specified key/block pairs from a TensorMap.
- Parameters:
tensor (TensorMap) – the
TensorMapto drop the key-block pair from.keys (Labels) – selection of keys to remove from the input
tensor. This can contain any subset of the names of the tensor’s keys.copy (bool) – if
True, the returnedTensorMapis constructed by copying the blocks from the input tensor. IfFalse(default), the values of the blocks in the outputTensorMapreference the same data as the input tensor. The latter can be useful for limiting memory usage, but should be used with caution when manipulating the underlying data.
- Return type:
- metatensor.drop_empty_blocks(tensor: TensorMap, copy: bool = False) TensorMap[source]¶
Drop any block in a
TensorMapwith an empty set of samples, components or properties.- Parameters:
tensor (TensorMap) – the
TensorMapto drop empty blocks from.copy (bool) – if
True, the returnedTensorMapis constructed by copying the blocks from the input tensor. IfFalse(default), the values of the blocks in the outputTensorMapreference the same data as the input tensor. The latter can be useful for limiting memory usage, but should be used with caution when manipulating the underlying data.
- Return type: