PyTorch的基本概念

1.什么是Pytorch,为什么选择Pytroch?

  • 作为NumPy的替代品,可以利用GPU的性能进行计算
  • 作为一个高灵活性、速度快的深度学习平台
  • Pytorch相比Tensorflow而言,它的设计初衷是简单易用用,所以它是基于动态图进行实现的,从而方便调试。当然,Tensorflow在1.5版的时候就引入了Eager Execution机制实现了动态图,但它还是默认使用静态图。

2.Pytroch的安装

  • 配置Python环境:
  • 安装anaconda,
  • 打开Anaconda prompt,输入conda install pytorch-cpu -c pytorch,下载packages,
  • 再输入pip install torchvision,torchvision安装成功。验证是否下载成功:打开Anaconda jupyter notebook,输入print(import torch),print(import torchvision),print(torch)
    不报错即可。

3.PyTorch基础概念

参考
https://blog.csdn.net/herosunly/article/details/88892326
https://blog.csdn.net/herosunly/article/details/88915673

4.Pytorch基本实现


# 4.PyTorch
mport torch as t
import torchvision as tv
import torchvision.transforms as transforms
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F

参考
https://blog.csdn.net/herosunly/article/details/89036914

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章