Post

Notes on Pytorch

Notes on Pytorch Learning

Notes on Pytorch

Notes on Pytorch

基础

Why GPU

GPU擅长处理可以并行化的任务,比如渲染,而AI模型的一些计算操作,比如池化、卷积是可以高度并行化的,因为计算的先后并不会影响最终的结果,因此训练模型适合用GPU

常用的torch包

PackageDescription
torchThe top-level PyTorch package and tensor library.
torch.nnA subpackage that contains modules and extensible classes for building neural networks.
torch.autogradA subpackage that supports all the differentiable Tensor operations in PyTorch.
torch.nn.functionalA functional interface that contains typical operations used for building neural networks like loss functions, activation functions, and convolution operations.
torch.optimA subpackage that contains standard optimization operations like SGD and Adam.
torch.utilsA subpackage that contains utility classes like data sets and data loaders that make data preprocessing easier.
torchvisionA package that provides access to popular datasets, model architectures, and image transformations for computer vision.

动态计算图(Dynamic Computing Graph)

能够在运行时动态地构建计算图

Tensor

  • 对于多维tensor来说,其每个维度的长度要相同

  • rank:表示tensor的维数
  • axis:用于指定特定的tensor维度
This post is licensed under CC BY 4.0 by the author.

Trending Tags