
pytorch学习笔记
文章平均质量分 51
三つ叶
这个作者很懒,什么都没留下…
展开
-
pytorch——torch.flatten() 和 torch.nn.Flatten()
flatten()函数的作用是将tensor铺平成一维torch.flatten(input, start_dim=0, end_dim=- 1) → Tensorinput (Tensor) – the input tensor.start_dim (int) – the first dim to flattenend_dim (int) – the last dim to flattenstart_dim和end_dim构成了整个你要选择铺平的维度范围下面举例说明x = torch.t原创 2021-11-16 09:06:59 · 3485 阅读 · 0 评论 -
DataLoader的使用
官方文档说明DataLoader(dataset, batch_size=1, shuffle=False, sampler=None, batch_sampler=None, num_workers=0, collate_fn=None, pin_memory=False, drop_last=False, timeout=0, worker_init_fn=None, *, prefetch_factor=2, p原创 2021-10-30 15:27:37 · 689 阅读 · 0 评论 -
卷积神经网络CNN和SSD、YOLO、Lenet、Alexnet、VGG等的关系
CNN,卷积神经网络,是以卷积为核心的一大类网络。LeNet、AlexNet、VGG、GoogLeNet,属于CNN。RCNN、Fast RCNN、Faster RCNN、YOLO、YOLOv2、SSD,也属于CNN,但和2是另一条路线。2和3的区别在于,2属于用于图像分类的CNN,3属于用于目标检测的CNN...原创 2021-02-04 12:18:47 · 11702 阅读 · 1 评论 -
Pytorch学习笔记——Tensor在GPU&CPU上操作
对复杂的神经网络和大规模的数据来说,我们一般将数据放在GPU上进行计算,下面介绍数据在GPU及CPU中相互切换的相关操作x = torch.tensor([1,2,3])print(x.device)x = x.cuda(0) # 当设备GPU数>1时,()中需要指定第几个GPUprint(x.device)...原创 2021-02-03 17:45:58 · 5404 阅读 · 0 评论 -
torch.no_grad & inplace operation知识点
关于 pytorch inplace operation, 需要知道的几件事x = torch.tensor([1,2,3], dtype=float, requires_grad=True)print(x.requires_grad)with torch.no_grad(): #x = x+2 # 此句话改变了原来的x内存地址,又因在with torch.no_grad中, # 所以新的x的require原创 2021-02-02 17:00:58 · 239 阅读 · 0 评论 -
pytorch学习笔记01_张量——Tensor基本常用操作
文章目录前言一、张量是什么?二、张量的属性三、张量创建3.1 依据原有数据创建3.1.1. torch.tensor()3.1.2 torch.from_numpy()3.2 数学方法创建3.2.1 torch.zeros()3.2.2 torch.ones()3.2.3 torch.fill()3.2.4 torch.arange()3.2.5 torch.linspace()3.2.6 torch.logspace()3.2.7 torch.eye()3.3 依概率分布创建张量3.3.1 torch.n原创 2021-01-20 22:41:57 · 879 阅读 · 0 评论 -
pytorch学习笔记02_自动求导及相关问题记录解决
有关pytorch中自动求导的文章初步认识:https://www.cnblogs.com/cocode/p/10746347.html这两篇比较详细:https://www.cnblogs.com/charleechan/p/12255191.htmlhttps://zhuanlan.zhihu.com/p/51385110举例子:http://blog.sina.com.cn/s/blog_573ef4200102xcxr.html...原创 2021-01-20 22:51:49 · 2355 阅读 · 0 评论