Miscellaneous

Version number

std::string metatensor_torch::version()

Get the runtime version of metatensor-torch as a string.

METATENSOR_TORCH_VERSION

Macro containing the compile-time version of metatensor-torch, as a string

METATENSOR_TORCH_VERSION_MAJOR

Macro containing the compile-time major version number of metatensor-torch, as an integer

METATENSOR_TORCH_VERSION_MINOR

Macro containing the compile-time minor version number of metatensor-torch, as an integer

METATENSOR_TORCH_VERSION_PATCH

Macro containing the compile-time patch version number of metatensor-torch, as an integer

TensorMap Serialization

void metatensor_torch::save(const std::string &path, TorchTensorMap tensor)

Save the given TensorMap to a file at path

torch::Tensor metatensor_torch::save_buffer(TorchTensorMap tensor)

Save the given TensorMap to an in-memory buffer (represented as a torch::Tensor of bytes)

TorchTensorMap metatensor_torch::load(const std::string &path)

Load a previously saved TensorMap from the given path.

TorchTensorMap metatensor_torch::load_buffer(torch::Tensor buffer)

Load a previously saved TensorMap from the given in-memory buffer (represented as a torch::Tensor of bytes)

TensorBlock Serialization

void metatensor_torch::save(const std::string &path, TorchTensorBlock block)

Save the given TensorBlock to a file at path

torch::Tensor metatensor_torch::save_buffer(TorchTensorBlock block)

Save the given TensorBlock to an in-memory buffer (represented as a torch::Tensor of bytes)

TorchTensorBlock metatensor_torch::load_block(const std::string &path)

Load a previously saved TensorBlock from the given path.

TorchTensorBlock metatensor_torch::load_block_buffer(torch::Tensor buffer)

Load a previously saved TensorBlock from the given in-memory buffer (represented as a torch::Tensor of bytes)

Labels Serialization

void metatensor_torch::save(const std::string &path, TorchLabels labels)

Save the given Labels to a file at path

torch::Tensor metatensor_torch::save_buffer(TorchLabels labels)

Save the given Labels to an in-memory buffer (represented as a torch::Tensor of bytes)

inline TorchLabels metatensor_torch::load_labels(const std::string &path)

Load previously saved Labels from the given path.

TorchLabels metatensor_torch::load_labels_buffer(torch::Tensor buffer)

Load previously saved Labels from the given in-memory buffer (represented as a torch::Tensor of bytes)