Changelog¶
All notable changes to metatensor-core are documented here, following the keep a changelog format. This project follows Semantic Versioning.
Unreleased¶
Version 0.2.1 - 2026-06-10¶
metatensor-core C¶
Changed¶
Labels no longer need to be on CPU; they can be on any device. The device of labels must now match the device of the block values, and
TensorBlockcreation validates this.TensorMapnow checks that the keys are on the same device as the blocks, raising an error if they differ.
metatensor-core C++¶
Added¶
TensorMap::unsafe_from_ptrto replace theTensorMap(mts_tensormap_t*)constructor, for symmetry with theTensorBlockAPI. The constructor is now deprecated and will be removed in a future version.Labels::unsafe_from_ptrto create a C++ object from an existingmts_labels_tpointer.TensorMap::unsafe_view_from_ptrto create a C++ view of an existing TensorMap, as well asTensorMap::is_viewandTensorBlock::is_view.Labels::release,TensorBlock::release, andTensorMap::releaseto take back ownership of the underlying C API pointers.
metatensor-core Python¶
Added¶
TensorMap.unsafe_from_ptr,TensorBlock.unsafe_from_ptrandLabels.unsafe_from_ptrto create Python classes from raw ctypes pointersTensorMap.unsafe_view_from_ptrandTensorBlock.unsafe_view_from_ptrto create non-owning views from existing raw pointers, as well asTensorMap.is_viewandTensorBlock.is_view.Labels.release,TensorBlock.release, andTensorMap.releaseto take back ownership of the underlying pointers.
Changed¶
Labelscan now be created from any supported array type (e.g. torch tensors), not just numpy arrays.Labels.to()now moves labels to the target device and arrays backend, matching the behavior ofTensorBlock.to().TensorBlock.to()andTensorMap.to()now also move labels (samples, components, properties) in addition to values and gradients.
Version 0.2.0 - 2026-05-13¶
metatensor-core C¶
Changed¶
mts_array_t.move_samples_fromis nowmts_array_t.move_data, and allows for more granular data movement.mts_sample_mapping_thas been renamed tomts_data_movement_t.mts_array_t.copynow takes adeviceparameter, indicating on which device the copy should live.Serialization of
mts_tensor_t,mts_block_tandmts_labels_tcan now be done even if the data lives on a different device or uses a dtype other than float64.mts_create_array_callback_tnow takes an extra parameter for the dtype to use when creating new arrays.mts_tensor_keys_to_samplesnow handles merging blocks with different set of properties.mts_tensor_keys_to_samples,mts_tensor_keys_to_propertiesandmts_array_t.createnow take afill_valueparameter, which will be used to fill missing values when merging blocks or creating new arrays respectively.mts_labels_tis now an opaque pointer, and stores data usingmts_array_t; allowing to remove the need to copy all data back to CPU when creating labels. As part of this,mts_labels_createis nowmts_labels, andmts_labels_create_assume_uniqueis nowmts_labels_assume_unique.mts_last_errorcan now return custom data and error origin together with the last error message. These can be set by a new functionmts_set_last_error.mts_labels_selectnow takes and returns the selection as an array ofsize_t, notint64_t.
Added¶
mts_array_t.as_dlpackfunction, returning the data using the dlpack standard. TensorBlock and Labels can now contain data on different devices and with varied dtypes.mts_array_t.from_dlpackfunction to create mts_array_t from a dlpack tensor.There are new functions
mts_block_device,mts_tensormap_device,mts_block_dtype,mts_tensormap_dtypeto access dtype and device of metatensor data.There are new functions to work with
mts_labels_t:mts_labels_dimensions,mts_labels_values, andmts_labels_values_cpu.mts_set_last_errorto set the last error that occured in a callback before transferring control back to libmetatensor. The data set by this function can then be retrieved withmts_last_errorand used to store and rethrow exceptions across the C API boundary.
Removed¶
Removed
mts_tensormap_blocks_matching, the same behavior can be achieved withmts_labels_selection.Removed
mts_array_t.data, users should usemts_array_t.as_dlpackinstead.
metatensor-core C++¶
Changed¶
TensorBlock::values()is now a templatevalues<T>()(defaulting todouble) and returns aDLPackArray<T>that owns the DLPack resource, preventing dangling-pointer issues.Labels::position,Labels::set_intersection,Labels::set_difference, andLabels::selectnow returns astd::optional<size_t>instead of relying on -1 as a sentinel value. The overloads takingint64_tpointers are still available for a zero overhead version.Labels::selectnow takes and returns the selection as an array ofsize_t, notint64_t.
Added¶
TensorBlock::device,TensorMap::device,TensorBlock::dtype, andTensorMap::dtypefunctions.The
MtsArrayclass, which provides a RAII wrapper and more convenient way to usemts_array_tfrom C++
Removed¶
Removed
TensorMap::blocks_matching, the same behavior can be achieved withTensorMap::keys().select(...).
metatensor-core Python¶
Added¶
Added
ExternalCudaArrayin Python, the CUDA counterpart toExternalCpuArray. It wraps non-Python CUDA data as atorch.Tensorvia DLPack, for use with external array backends that store data on CUDA devices.
Changed¶
TensorBlock.copyandTensorMap.copynow accept adeepparameter to control whether to perform a deep or shallow copy.
Removed¶
LabelsViewhas been removed, and with it the following functions:Labels.is_view(),Labels.to_owned(),Labels.view(), andLabels.__getitem__(list[str]). We recomend usingLabels.column()instead to access the values of individual dimensions of Labels.Removed
TensorMap.blocks_matching, the same behavior can be achieved withTensorMap.keys.select(...).
Version 0.1.20 - 2026-02-27¶
Fixed¶
Ensure the
infoofTensorMapis kept in the new tensor whenkeys_to_samples,components_to_properties, andkey_to_propertiesare calledPin getrandom to make sure the code compiles with rustc 1.74
Version 0.1.19 - 2025-12-11¶
Fixed¶
Reset the size of the buffer produced by
mts_tensormap_save_buffer,mts_block_save_buffer, andmts_labels_save_bufferto the same size as v0.1.17
Version 0.1.18 - 2025-12-04¶
Added¶
It is now possible to store and retrieve global metatadata about a TensorMap, in the form of string key/value pairs. The following API are available to manipulate this information:
in C, you can use
mts_tensormap_set_info,mts_tensormap_get_infoandmts_tensormap_info_keysin C++, you can use
TensorMap::set_info,TensorMap::get_infoandTensorMap::infoin Python, you can use
TensorMap.set_info,TensorMap.get_infoandTensorMap.info
Changed¶
We now requires at least cmake v3.22 to compile metatensor
We now require Python >= 3.10
Fixed¶
TensorMap::components_to_propertiesnow properly handles multiple components at once.
Version 0.1.17 - 2025-09-02¶
Fixed¶
The pre-built wheels on PyPI are now compiled in release mode again
Changed¶
We removed some overhead when creating
Labelsby lazily initializing more internal data (#971)
Version 0.1.16 - 2025-08-22¶
Fixed¶
Fix the use of pre-compiled metatensor from CMake (#954)
Fix the compilation with rustc >=1.89 and rustc <1.80 (#959)
Version 0.1.15 - 2025-07-29¶
Changed¶
TensorMap.to,TensorBlock.to, andLabels.tonow accept anon_blockingargument, with the same meaning as intorch.Tensor.to.
Added¶
mts_labels_create_assume_uniqueto createmts_labelswithout checking that the entries are unique; as well as the corresponding flag in the C++ and Python constructors. This allows bypassing a check when the user can ensure beforehand that all entries will be unique.
Version 0.1.14 - 2025-04-11¶
Fixed¶
The
metatensor::sharedandmetatensor::statictargets in CMake are no longer global, allowing multiple calls tofind_package(metatensor)
Version 0.1.13 - 2025-04-10¶
metatensor-core C¶
Added¶
mts_labels_differencefor finding the set difference between twomts_labels_t
metatensor-core C++¶
Added¶
Labels::set_differencefor finding the set difference between twoLabels
metatensor-core Python¶
Added¶
Labels.differenceandLabels.difference_and_mappingfor finding the set difference between twoLabels
Version 0.1.12 - 2025-02-17¶
Changed¶
The default extension for file serialization is now
.mtsinstead of.npz
Version 0.1.11 - 2024-10-23¶
Changed¶
The code now requires Rustc v1.74 to build.
Labels creation is quite a bit faster for large labels thanks to #752 and #754
Version 0.1.10 - 2024-08-28¶
metatensor-core C++¶
Added¶
Labels::selectto sub-select entries in labelsAdded support for serialization of TensorBlock with
TensorBlock::load,TensorBlock::load_buffer,TensorBlock::save,TensorBlock::save_bufferand the corresponding functions inmetatensor::io.
metatensor-core C¶
Added¶
mts_labels_selectto sub-select entries in labelsAdded support for serialization of TensorBlock with
mts_block_load,mts_block_load_buffer,mts_block_save, andmts_block_save_buffer.
metatensor-core Python¶
Added¶
Labels.selectto sub-select entries in labelsAdded support for serialization of TensorBlock with
TensorBlock.load,TensorBlock.load_buffer,TensorBlock.save,TensorBlock.save_bufferand the corresponding functions inmetatensor.io.
Version 0.1.9 - 2024-07-15¶
metatensor-core Python¶
Added¶
TensorBlock.__len__andTensorBlock.shape, which return the length and shape of the values in the block respectivelyWe can now load (but not save) TensorMap stored in npz files using DEFLATE compression (#671)
Changed¶
We now require Python >= 3.9
Fixed¶
Fixed a memory leak affecting all data stored in TensorBlock (#683)
Version 0.1.8 - 2024-05-13¶
Fixed¶
fix the build when using metatensor from the Rust bindings
Version 0.1.7 - 2024-05-13¶
metatensor-core C/C++¶
Added¶
preprocessor macros containing the version number of metatensor:
METATENSOR_VERSION,METATENSOR_VERSION_MAJOR,METATENSOR_VERSION_MINOR, andMETATENSOR_VERSION_PATCH.
Changed¶
installation configuration in CMake now uses the standard
GNUInstallDirs
Fixed¶
removed dependency on
bcrypton Windowsthe shared libraries is installed with execute permissions
Version 0.1.6 - 2024-05-03¶
metatensor-core C/C++¶
Fixed¶
fixed compilation with Rust 1.78 (#605)
fixed compilation on some Windows systems (#575)
Version 0.1.5 - 2024-04-09¶
metatensor-core C++¶
Fixed¶
fixed compilation with cmake 3.29.1 (#573)
metatensor-core Python¶
Changed¶
allow positional arguments in
TensorMap.to/TensorBlock.to(#556)
Version 0.1.4 - 2024-03-01¶
Fixed¶
fixed compilation on macOS (#525)
added checks for the size of the new values in
Labels.insert(#519)
Version 0.1.3 - 2024-02-12¶
Fixed¶
Fixed the build with Cargo 1.65 (#505)
Pin dependencies for metatensor-core, ensuring reproducibility of the build as new dependencies versions are published (#506)
Version 0.1.2 - 2024-01-26¶
metatensor-core C++¶
Added¶
Offer serialization functionality as free standing functions (i.e.
metatensor::io::load) in addition to the existing associated functions (i.e.TensorMap::load) (#453)Serialization of labels with
Labels::save,Labels::load,Labels::save_buffer,Labels::load_bufferand the corresponding free functions. (#455)
Changed¶
TensorMap::save_string_bufferhas been replaced with the template version ofTensorMap::save_buffer
metatensor-core C¶
Added¶
mts_labels_save,mts_labels_load,mts_labels_save_buffer, andmts_labels_load_bufferto handle serialization ofmts_labels_t
metatensor-core Python¶
Added¶
TensorMap.toandTensorBlock.toto change the device, dtype, or backend (numpy or torch) of all arrays stored by metatensorLabels.device,TensorBlock.deviceandTensorMap.device; as well asTensorMap.dtype, andTensorBlock.dtypeto query the current device and dtype used by the data.Offer serialization functionality as member functions (i.e.
TensorMap.load) in addition to the existing free standing functions (i.e.metatensor.load) (#453)Serialization of labels with
Labels.save,Labels.load,Labels.save_buffer,Labels.load_bufferand the corresponding free functions.
Version 0.1.1 - 2024-01-05¶
Fixed¶
Fixed the build with Cargo 1.75 (#438)
Allowed saving and loading empty TensorMap; i.e. TensorMap where one of the dimensions of the array has 0 elements (#419)
Version 0.1.0 - 2023-10-11¶
metatensor-core C¶
Added¶
Initial implementation of all the core classes of metatensor:
mts_labels_t,mts_block_t,mts_tensormap_t,mts_array_tand the corresponding functions;Serialization for
mts_tensormap_tusing a format derived from numpy’s npz format
metatensor-core C++¶
Added¶
C++ API for all the C data structures as C++ classes:
Labels,TensorBlock,TensorMap;Wrapper around
mts_array_tas an abstract base classDataArrayBase;Basic implementations of
DataArrayBaseinSimpleDataArrayandEmptyDataArray;Basic n-dimensional array class
NDArray<T>, intended to give a minimal API to use data stored inTensorBlockeven if this data does not come from C++ initially;
metatensor-core Python¶
Added¶
Python API for all the C data structures as Python classes:
Labels,LabelsEntry,TensorBlock,TensorMap;Wrapper around
mts_array_tas an abstract base classmetatensor.data.Array;Implementation of
metatensor.data.Arraywithnumpy.ndarrayandtorch.Tensor;