arXiv(opens in a new tab)Computer ScienceDec 2019Cited by 74 papers on PaperVantageClassic Paper

Manuscript Offprint

arXiv:1912.01703

PyTorch: An Imperative Style, High-Performance Deep Learning Library

Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, N. Gimelshein, L. Antiga, Alban Desmaison, A. Köpf, E. Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, Soumith Chintala

Adam Paszke

University of Warsaw

adam.paszke@gmail.com

Adam Lerer

Facebook AI Research

alerer@fb.com

Trevor Killeen

Self Employed

killeent@cs.washington.edu

Sam Gross

Facebook AI Research

sgross@fb.com

James Bradbury

Google

jekbradbury@gmail.com

Luca Antiga

Orobix

luca.antiga@orobix.com

Zeming Lin

Facebook AI Research

zlin@fb.com

Edward Yang

Facebook AI Research

ezyang@fb.com

Francisco Massa

Facebook AI Research

fmassa@fb.com

Gregory Chanan

Facebook AI Research

gchanan@fb.com

Alykhan Tejani

Twitter

atejani@twitter.com

Natalia Gimelshein

NVIDIA

ngimelshein@nvidia.com

Alban Desmaison

Oxford University

alban@robots.ox.ac.uk

Zach DeVito

Facebook AI Research

zdevito@cs.stanford.edu

Sasank Chilamkurthy

Qure.ai

sasankchilamkurthy@gmail.com

Andreas Köpf

Xamla

andreas.koepf@xamla.com

Lu Fang

Facebook

lufang@fb.com

Martin Raison

Nabla

martinraison@gmail.com

Benoit Steiner

Facebook AI Research

benoitsteiner@fb.com

Junjie Bai

Facebook

jbai@fb.com

Soumith Chintala

Facebook AI Research

soumith@gmail.com

Abstract

Deep learning frameworks have often focused on either usability or speed, but not both. PyTorch is a machine learning library that shows that these two goals are in fact compatible: it provides an imperative and Pythonic programming style that supports code as a model, makes debugging easy and is consistent with other popular scientific computing libraries, while remaining efficient and supporting hardware accelerators such as GPUs.

In this paper, we detail the principles that drove the implementation of PyTorch and how they are reflected in its architecture. We emphasize that every aspect of PyTorch is a regular Python program under the full control of its user. We also explain how the careful and pragmatic implementation of the key components of its runtime enables them to work together to achieve compelling performance.

We demonstrate the efficiency of individual subsystems, as well as the overall speed of PyTorch on several common benchmarks.

33rd Conference on Neural Information Processing Systems (NeurIPS 2019), Vancouver, Canada.

1 Introduction

With the increased interest in deep learning in recent years, there has been an explosion of machine learning tools. Many popular frameworks such as Caffe [1], CNTK [2], TensorFlow [3], and Theano [4], construct a static dataflow graph that represents the computation and which can then be applied repeatedly to batches of data. This approach provides visibility into the whole computation ahead of time, and can theoretically be leveraged to improve performance and scalability. However, it comes at the cost of ease of use, ease of debugging, and flexibility of the types of computation that can be represented.

Prior work has recognized the value of dynamic eager execution for deep learning, and some recent frameworks implement this define-by-run approach, but do so either at the cost of performance (Chainer [5]) or using a less expressive, faster language (Torch [6], DyNet [7]), which limits their applicability.

However, with careful implementation and design choices, dynamic eager execution can be achieved largely without sacrificing performance. This paper introduces PyTorch, a Python library that performs immediate execution of dynamic tensor computations with automatic differentiation and GPU acceleration, and does so while maintaining performance comparable to the fastest current libraries for deep learning. This combination has turned out to be very popular in the research community with, for instance, 296 ICLR 2019 submissions mentioning PyTorch.

References (24)

  • Caffe: Convolutional Architecture for Fast Feature Embedding
  • Cntk: Microsoft’s open-source deep-learning toolkit
  • TensorFlow: Large-scale machine learning on heterogeneous systems, 2015
  • Chainer: a next-generation open source framework for deep learning
  • Torch: a modular machine learning software library
  • DyNet: The Dynamic Neural Network Toolkit
  • MATLAB and Statistics Toolbox
  • Julia: A fresh approach to numerical computing
  • Lush reference manual
  • Automatic differentiation in machine learning: A survey
  • Open source scientific tools for Python, 2001-
  • Eblearn: Open-source energy-based learning in c++
  • cuDNN: Efficient Primitives for Deep Learning
  • Fast algorithms for convolutional neural networks
  • Torch7: A matlab-like environment for machine learning
  • MNIST handwritten digit database
  • Starcraft II: A new challenge for reinforcement learning (opens arXiv in a new tab)
  • Automatic differentiation in pytorch
  • Automatic differentiation facilitates of-integration into steering-angle-based road vehicle tracking
  • Forward modeling for partial observation strategy games - a starcraft defogger
  • Hoard: A scalable memory allocator for multithreaded applications
  • Tcmalloc: Thread-caching malloc
  • Hogwild: A lock-free approach to parallelizing stochastic gradient descent
  • Quantifying the performance of garbage collection vs. explicit memory management

Cited by (74)