![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
深度学习
C_going001
这个作者很懒,什么都没留下…
展开
-
Pytorch基本使用系列(四)合并和切割
broadcasting-able 从最后一个维度开始匹配,所匹配得对象维度为1或者相同才能进行扩张。 a = [4,32,14,14] b = [1,32,1,1]---[4,32,14,14] b = [14,14]---[1,1,14,14]---[4,32,14,14] 错误 b = [2,32,14,14] 合并 cat a.shape() = [4,32,8] b...原创 2019-09-12 10:58:13 · 786 阅读 · 0 评论 -
Pytorch基本使用系列(三)维度变换
维度变换: View/reshape: a.shape = [4,1,28,28] a.reshape(4,28*28).shape() = [4,784] a.reshape(4*28,28).shape() = [112,28] Squeeze 挤压, unsqueeze 展开 a.shape() = [4,1,28,28] a.unsqueeze(index).shape() ...原创 2019-09-11 22:39:32 · 669 阅读 · 0 评论 -
Pytorch基本使用系列(二)基本数据的创建与索引
创建数据的几种方法 利用numpy创建数据来 torch.from_numpy(a) 将numpy的数据导入到pytorch 常用的函数 np.ones([2,3]) 从list里面直接导入 例如 torch.tensor([2,3.2]) 接受现成的数据 torch.Tensor(1,2) 接受数据的shape torch初始化 Torch.empty() Torch.FloatTen...原创 2019-09-10 22:04:04 · 459 阅读 · 0 评论 -
Pytorch基本使用系列(一)基本数据类型
基本数据类型 python:Int, float, Int array, Float array, string pytorch: IntTensor of size, FloatTensor of size,IntTensor of size [d1,,,dn], FloatTensor of size[d1,,,dn], (one-hot,Embedding) 重点是(CPU):F...原创 2019-09-10 20:25:54 · 182 阅读 · 0 评论