![](https://img-blog.csdnimg.cn/20200130084740982.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
pytorch
pytorch学习
顾道长生'
时人不识凌云木,直待凌云始道高。
展开
-
pytorch维度变换
import torch as ta=t.rand(4,1,28,28)a.shapetorch.Size([4, 1, 28, 28])a.view(4,28*28)tensor([[0.7170, 0.7973, 0.8322, ..., 0.2318, 0.9531, 0.6618], [0.7864, 0.9424, 0.7775, ..., 0.729...原创 2020-01-30 18:15:52 · 246 阅读 · 0 评论 -
pytorch索引与切片
import torch as ta=t.rand(4,3,28,28)a[0].shapetorch.Size([3, 28, 28])a[0,0].shapetorch.Size([28, 28])a[0,0,2,4]tensor(0.0997)a.shapetorch.Size([4, 3, 28, 28])a[:2].shapetorch.Size...原创 2020-01-30 09:34:05 · 322 阅读 · 0 评论 -
pytorch创建Tensor
import numpy as npimport torch as ta=np.array([2,3.3])t.from_numpy(a)tensor([2.0000, 3.3000], dtype=torch.float64)a=np.ones([2,3])t.from_numpy(a)tensor([[1., 1., 1.], [1., 1., 1.]],...原创 2020-01-29 17:59:56 · 269 阅读 · 0 评论 -
pytorch 手写数字识别
import torch as tfrom matplotlib import pyplot as pltdef plot_curve(data): fig=plt.figure() plt.plot(range(len(data)),data,color='blue') plt.legend(['value'],loc='upper right') plt....原创 2020-01-28 18:58:05 · 348 阅读 · 0 评论