Pytorch 学习
PyTorch: Fundamental Concepts
Tensor: Like a numpy array, but can run on GPU
Autograd: Package for building computational graphs out of Tensors, and automatically computing gradients
Module: A neural network layer; may store state or learnable weights
参考:
http://cs231n.stanford.edu/slides/2019/cs231n_2019_lecture06.pdf,p41
Pipline
define tensors: input, weights
build computational graph: neural network model, forward pass, loss
backward pass: done by autograd
optimization: weights upgrade
Types of building nn model
- Tensor(定义weights), building model when forward passing, p50-59
- nn(已经包含了weights) + sequential containers, p60-67
- nn Module, p68-72
- nn Module(subclasses) + Sequential containers, p73-75
Dataloader: A DataLoader wraps a Dataset and provides minibatching, shuffling, multithreading, for you.
When you need to load custom data, just write your own Dataset class, p76-77
周边
torchvision: for utilizing pretrained models
visdom, tensorboardx: visualization tools, p78-80