PyTorch 2.1 Released: Automatic Dynamic Shapes and torch.export
PyTorch 2.1 added automatic dynamic shape support in torch.compile, distributed checkpointing across ranks, torch.compile support for NumPy, and a prototype torch.export full-graph capture mechanism.
Historical Archive. This article documents an event from 2023 and is preserved with its original date for reference. It is not current news, and details may have changed since publication.
What happened
PyTorch 2.1 was released on October 4, 2023, according to the official release notes in the PyTorch GitHub repository. Composed of 6,682 commits from 784 contributors since 2.0, it built on the compiler-centric direction of the PyTorch 2 series with performance and usability improvements.
Automatic dynamic shapes
The headline feature was automatic dynamic shape support in torch.compile, which automatically detects and minimises recompilations caused by tensor-shape changes. Rather than requiring developers to manually mark dimensions as dynamic, torch.compile now finds dynamic dimensions and selectively turns on dynamism, reducing the recompilation overhead that could hurt performance on workloads with varying input sizes.
Distributed checkpointing and NumPy
PyTorch 2.1 introduced torch.distributed.checkpoint, which enables saving and loading models from multiple ranks in parallel and supports resharding when the cluster topology changes, easing large distributed training. It also let torch.compile compile NumPy operations by translating them into equivalent PyTorch operations, and improved torch.compile support for Python 3.11.
torch.export and performance
The release introduced torch.export as a prototype, a sound full-graph capture mechanism, along with torch.export-based quantization. It added new CPU performance features including TorchInductor improvements with bfloat16 and dynamic shapes, AVX512 kernel support, and CPU optimizations for scaled-dot-product attention, plus prototype support for semi-structured 2:4 sparsity on NVIDIA GPUs.
Why it mattered
PyTorch 2.1 matured the torch.compile experience introduced in 2.0. Automatic dynamic shapes removed a common source of recompilation slowdowns, distributed checkpointing addressed real needs of large-scale training, and the prototype torch.export laid groundwork for deploying PyTorch models beyond eager execution.
Related on Skillo
See also: PyTorch 2.0 and torch.compile, PyTorch 2.4's Python 3.12 support.
Sources
Published date reflects the original event date (2023-10-04). This article is original Skillo editorial written from the sources above; facts were verified in September 2026.
Written by
Skillo Staff
0 Comments
Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.