libtorch is the PyTorch's C++ frontend providing a high-level interaction for the machine learning research and production use.
The PyTorch C++ frontend provides a high level, pure C++ modeling interface for neural network and general machine learning research and production use cases, largely following the Python API in design and provided functionality. The C++ frontend includes the following:
An interface for defining machine learning models through a hierarchical module system (like
torch.nn.Module
);A “standard library” of pre-existing modules for the most common modeling purposes (e.g. convolutions, RNNs, batch normalization etc.);
An optimization API, including implementations of popular optimizers such as SGD, Adam, RMSprop, and others;
A means of representing datasets and data pipelines, including functionality to load data in parallel over many CPU cores;
A serialization format for storing and loading checkpoints of a training session (like
torch.utils.data.DataLoader
);Automatic parallelization of models onto multiple GPUs (like
torch.nn.parallel.DataParallel
);Support code to easily bind C++ models into Python using
pybind11
;Entry points to the TorchScript JIT compiler;
Helpful utilities to facilitate interfacing with the Aten and Autograd APIs.