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
Modules containing metatensor data¶
-
class Module : public torch::jit::Module¶
Replacement class for
torch::jit::Module
to be used when the module contains metatensor data. This class overrides the behavior ofto()
to also move metatensor data to the correct dtype and device.Public Functions
-
inline Module(torch::jit::Module module)¶
Construct a
metatensor_torch::Module
wrapping the giventorch::jit::Module
.
-
void to(at::Device device, at::ScalarType dtype, bool non_blocking = false)¶
Move all the data in the module to the given
device
anddtype
-
void to(at::ScalarType dtype, bool non_blocking = false)¶
Move all the data in the module to the given
dtype
-
void to(at::Device device, bool non_blocking = false)¶
Move all the data in the module to the given
device
-
inline Module(torch::jit::Module module)¶
TensorMap
Serialization¶
-
void metatensor_torch::save(const std::string &path, TensorMap tensor)¶
Save the given
TensorMap
to a file atpath
-
torch::Tensor metatensor_torch::save_buffer(TensorMap tensor)¶
Save the given
TensorMap
to an in-memory buffer (represented as atorch::Tensor
of bytes)
TensorBlock
Serialization¶
-
void metatensor_torch::save(const std::string &path, TensorBlock block)¶
Save the given
TensorBlock
to a file atpath
-
torch::Tensor metatensor_torch::save_buffer(TensorBlock block)¶
Save the given
TensorBlock
to an in-memory buffer (represented as atorch::Tensor
of bytes)
-
TensorBlock metatensor_torch::load_block(const std::string &path)¶
Load a previously saved
TensorBlock
from the given path.
-
TensorBlock metatensor_torch::load_block_buffer(torch::Tensor buffer)¶
Load a previously saved
TensorBlock
from the given in-memory buffer (represented as atorch::Tensor
of bytes)
Labels
Serialization¶
-
void metatensor_torch::save(const std::string &path, Labels labels)¶
Save the given
Labels
to a file atpath
-
torch::Tensor metatensor_torch::save_buffer(Labels labels)¶
Save the given
Labels
to an in-memory buffer (represented as atorch::Tensor
of bytes)