1. Getting Started with PyTorch
2.Build Your First Neural Network with PyTorch
3. Transfer Learning for Image Classification using Torchvision

1. Getting Started with PyTorch

p 5 , pytorch คือ open source ML framework ที่ accelerate path จาก research prototying to production deployment
เป็น sweet way ในการ solve ML problem ใน real world

1 In [0]: !pip install -q -U torch watermark
2
3 In [0]: %load_ext watermark
4         %watermark -v -p numpy,torch
5
6 Out[0]: CPython 3.6.9
7         IPython 5.5.0
8
9 numpy 1.17.5
10 torch 1.4.0

PT(PyTorch) , Numpy(Np)
p 6 , PT
<<< แต่ก่อนทำ ต้อง install PT ใน jupyter ก่อน

1 In [0]: import torch
2         import numpy as np
3
4 In [0]: a = np.array([1, 2])
5         b = np.array([8, 9])
6
7 c = a + b
8 c
9
10 Out[0]: array([ 9, 11])

p 6 , เหมือน PT

1 In [0]: a = torch.tensor([1, 2])
2         b = torch.tensor([8, 9])
3
4 c = a + b
5 c
6
7 Out[0]: tensor([ 9, 11])

ดังนั้นเราสามารถปป จาก Np -> PT , ^แสดงว่า np.array เหมือนกับ torch.tensor

1 In [0]: a = torch.tensor([1, 2])
2
3 a.numpy()
4
5 Out[0]: array([1, 2])

หรือในทางกลับกัน

1 In [0]: a = np.array([1, 2])
2 torch.from_numpy(a)
3
4 Out[0]: tensor([1, 2])

หมายถึงว่าการ conversion no cost เพื่อ performance app
ทั้ง Np , PT ถือว่า store data in memory same way
PT ใช้ reusing work done โดย Np
p 7 , Tensors
เป็น n-dimension number รวมถึง boolean containers
มี support data type PT tensor doc
สร้าง tensor

2.Build Your First Neural Network with PyTorch

3. Transfer Learning for Image Classification using Torchvision