A Brief Introduction To Pytorch: (A Deep Learning Library)
A Brief Introduction To Pytorch: (A Deep Learning Library)
Huaipeng Zhao
pytorch.org
Outline
Why Deep Learning Libraries and Why PyTorch ?
A Brief Introduction to PyTorch
PyTorch in action
Outline
Why Deep Learning Libraries and Why PyTorch ?
A Brief Introduction to PyTorch
PyTorch in action
Why a DL Library is Necessary?
• Complicated DL architectures
• Easily build big computational graphs
• Easily compute gradients
Why a DL Library is Necessary?
• Run it all efficiently on GPU
Popular Deep Learning Libraries
Why
• Support Python
• Dynamic Graph
• Friendly API for research
• Easily debug
• Love all things [Pythonic]
Outline
Why Deep Learning Libraries and Why PyTorch ?
A Brief Introduction to PyTorch
PyTorch in action
Installing
Three Levels of Abstraction
• Tensor: Imperative ndarray
• Variable: Node in a computational graph (data,grad)
• Module: A neural network layer
A Toy Neural Network
Forward
A Toy Neural Network
Forward
Tensor
A Toy Neural Network
Backward
A Toy Neural Network
Major Components of PyTorch
Package Description
torch a Tensor library like NumPy, with strong GPU support
torch.nn a neural networks library deeply integrated with autograd designed for
maximum flexibility
Numpy
PyTorch
Torch.nn : a neural networks library
Torch.nn
Torch.nn.functional
How to load dataset?
How to build a model?
How to train a model?
Outline
Why Deep Learning Libraries and Why PyTorch ?
A Brief Introduction to PyTorch
PyTorch in action
MNIST Dataset
MLP for MNIST (0-d features)
10
64
28*28
MLP for MNIST
GRU
GRU GRU
GRU … GRU
GRU
28
…
28
RNN for MNIST