This is a preliminary version of the lab series of Deep Learning for Healthcare
in CSE6250 Big Data Analytics for Healthcare by Prof. Jimeng Sun
Table of Contents
PyTorch is a python package that provides two high-level features1:
- Tensor computation like numpy with strong GPU acceleration
- Deep Neural Networks built on a tape-based autograd system
If you have ever used numpy in Python, you already have used Tensors (a.k.a ndarray)1
PyTorch provides Tensors that can be created and manipulated on both CPU and GPU. Also, it is easy to convert numpy ndarray to PyTorch Tensor and vice versa.
One of the advantages PyTorch has is that it uses dynamic computation graph. On the other hand, most of other deep learning frameworks such as TensorFlow, Theano, Caffe, and CNTK use a static computation graph. Thus, we need to define and compile the network completely before actually using (traininig) it. With PyTorch, however, we can change the way the network behaves arbitratily.
We will learn the following topics in this chapter:
- Pytorch Tensor
- Converting between Tensor and ndarray (Numpy)
- Indexing and Math operations
- GPU Acceleration
- Automatic differentiation with Variable
Let’s get started with some examples here!