PyTorch 1.5 arrives with stable C++ frontend API

The second PyTorch release of the year has landed. PyTorch 1.5 brings some of the deep learning library’s previously experimental features into stable mode, including the C++ frontend API. Let’s take a closer look and see what that means—and what else has been updated in this release.
PyTorch 1.5 has been released. The open source machine learning library developed by Facebook AI Research has several new features on board, mainly a stable C++ frontend API that was still experimental until now.
Aside from several new features, this release also includes backwards incompatible changes and drops support for the language version Python 2 which reached its end of life in January 2020.
SEE ALSO: Combatting AI bias: remembering the human at the heart of the data is key
Stable C++ frontend API
Now at parity with Python, the C++ frontend API has been declared stable in PyTorch 1.5. For example, this means that models can now be translated from the Python API to the C++ API, and that the behavior of the C++ optimizers has become identical to the Python API.
The stable version also comes with a new C++ tensor multi-dim indexing API: tensor.index({Slice(), 0, "...", mask})
behaves similar to the Python API’s tensor[:, 0, ..., mask]
syntax and creates the same result. This removes the need for a workaround, which was previously achieved by combining narrow
/ select
/ index_select
/ masked_select
.
Other updates
In PyTorch 1.5, the distributed RPC framework APIs have also been moved to stable mode, and additional features were added as experimental. The experimental features include a new API for binding C++ classes into PyTorch and TorchScript, which uses a syntax that is nearly identical to pybind11, and a new high-level autograd API.
SEE ALSO: Integrating Python with Java
It should also be noted that several backwards incompatible changes are included in this release regarding Python, the C++ API, JIT, quantization, and RPC.
For more details, see the release notes and blog post.