随笔分类 -  pytorch

1 2 下一页

不能装torch 1.6.0
摘要:python 3.6.2可以装torch1.6.0 python3.6.0 不行 新建虚拟环境 python==3.6.2 即可 阅读全文

posted @ 2021-04-19 10:38 cltt 阅读(639) 评论(0) 推荐(0) 编辑

torch.load()加载模型,提示xxx.pt is a zip archive(did you mean to use torch.jit.load()?)
摘要:参考链接 https://blog.csdn.net/irober/article/details/115144522?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-0&spm=1001.2101.3001.4242 t 阅读全文

posted @ 2021-04-02 10:00 cltt 阅读(2605) 评论(0) 推荐(0) 编辑

torch cuda torchvision 版本对应关系
摘要:cuda torch 参考链接:https://blog.csdn.net/weixin_42069606/article/details/105198845?utm_medium=distribute.wap_relevant.none-task-blog-BlogCommendFromMachi 阅读全文

posted @ 2021-03-31 16:33 cltt 阅读(3967) 评论(0) 推荐(0) 编辑

torch.mul() 和 torch.mm() 区别
摘要:torch.mul(a, b)是矩阵a和b对应位相乘,a和b的维度必须相等,比如a的维度是(1, 2),b的维度是(1, 2),返回的仍是(1, 2)的矩阵torch.mm(a, b)是矩阵a和b矩阵相乘,比如a的维度是(1, 2),b的维度是(2, 3),返回的就是(1, 3)的矩阵 阅读全文

posted @ 2021-03-15 17:23 cltt 阅读(553) 评论(0) 推荐(0) 编辑

nn.PixelShuffle
摘要:class torch.nn.PixleShuffle(upscale_factor) 这里的upscale_factor就是放大的倍数,数据类型为int。 例子 >>> ps = nn.PixelShuffle(3) >>> input = torch.tensor(1, 9, 4, 4) >>> 阅读全文

posted @ 2021-03-14 21:41 cltt 阅读(814) 评论(0) 推荐(0) 编辑

F.unfold F.fold F.normalize()
摘要:import torch.nn.functional as F F.unfold https://blog.csdn.net/qq_34914551/article/details/102940368 F.normalize()https://blog.csdn.net/ECNU_LZJ/artic 阅读全文

posted @ 2021-03-14 15:11 cltt 阅读(1184) 评论(0) 推荐(0) 编辑

torch.gather()
摘要:作用:收集输入的特定维度指定位置的数值参数:input(tensor): 待操作数。不妨设其维度为(x1, x2, …, xn)dim(int): 待操作的维度。index(LongTensor): 如何对input进行操作。其维度有限定,例如当dim=i时,index的维度为(x1, x2, …y 阅读全文

posted @ 2021-03-13 16:43 cltt 阅读(212) 评论(0) 推荐(0) 编辑

tensor 3维分块乘法
摘要:a = torch.range(1,4) a = a.reshape(2,1,2) b= torch.range(1,12) b = b.reshape(2,2,3) c = torch.bmm(a,b) print('c') print(c) print(c.shape) d = torch.ze 阅读全文

posted @ 2021-03-13 15:31 cltt 阅读(213) 评论(0) 推荐(0) 编辑

ImportError: libGL.so.1: cannot open shared object file: No such file or directory
摘要:import cv2 ImportError: libGL.so.1: cannot open shared object file: No such file or directory apt install libgl1-mesa-glx apt-get update 但是apt-get upd 阅读全文

posted @ 2021-02-10 21:27 cltt 阅读(961) 评论(0) 推荐(0) 编辑

pytorch 断点续训练
摘要:checkpoint = torch.load('.pth') net.load_state_dict(checkpoint['net']) criterion_mse = torch.nn.MSELoss().to(cfg.device) criterion_L1 = L1Loss() optim 阅读全文

posted @ 2020-12-05 22:26 cltt 阅读(817) 评论(2) 推荐(0) 编辑

tensor 类型转换
摘要:在Tensor后加 .long(), .int(), .float(), .double()等即可,也可以用.to()函数进行转换,所有的Tensor类型可参考https://pytorch.org/docs/stable/tensors.html import torch a = torch.Do 阅读全文

posted @ 2020-11-27 19:48 cltt 阅读(1578) 评论(0) 推荐(0) 编辑

skimage
摘要:skimage.io.imread io.imread读出图片格式是uint8(unsigned int);value是numpy array;图像数据是以RGB的格式进行存储的,通道值默认范围0-255。 阅读全文

posted @ 2020-11-11 16:30 cltt 阅读(141) 评论(0) 推荐(0) 编辑

pytorch 怎么用tensorboard 可视化
摘要:参考链接: https://mp.weixin.qq.com/s?__biz=MzI5MDUyMDIxNA==&mid=2247514888&idx=2&sn=3884cf50b88eaee6744d35cb528c0fa7&chksm=ec1c56f1db6bdfe7585830d13a36736 阅读全文

posted @ 2020-11-05 21:22 cltt 阅读(991) 评论(0) 推荐(0) 编辑

torch.nn.MSELoss()函数解读
摘要:函数作用torch.nn.MSELoss() 求predict和target之间的loss。 代码示例单个求其loss: crit = nn.MSELoss() # target = torch.Tensor(1) # target[0] = 10 # res = torch.Tensor(1) # 阅读全文

posted @ 2020-10-30 15:22 cltt 阅读(8023) 评论(0) 推荐(0) 编辑

torch.cuda.is_available() False
摘要:这里的cuda=10.1 需要: pip install --default-timeout=1000 torch==1.3.1 torchvision==0.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple torch ,torchvision 要和c 阅读全文

posted @ 2020-10-30 09:18 cltt 阅读(443) 评论(0) 推荐(0) 编辑

pytorch中函数名后有下划线和没有下划线
摘要:一般来说,在pytorch中如果对tensor的一个函数后加上了下划线,则表明这是一个in-place类型,所谓in-place类型是指在一个tensor上操作了之后,是直接修改了这个tensor,还是返回一个新的tensor,而旧的tensor并不修改。 例如: clamp和clamp_ x = 阅读全文

posted @ 2020-09-05 12:23 cltt 阅读(653) 评论(0) 推荐(0) 编辑

torch.clamp() 函数
摘要:torch.clamp(input, min, max, out=None) → Tensor 将输入input张量每个元素的夹紧到区间 [min,max][min,max],并返回结果到一个新张量。 操作定义如下: | min, if x_i < miny_i = | x_i, if min <= 阅读全文

posted @ 2020-09-05 12:19 cltt 阅读(5558) 评论(0) 推荐(0) 编辑

pytorch中tensor.mean(axis, keepdim)
摘要:1 import numpy as np 2 import torch 3 4 x=[ 5 [[1,2,3,4], 6 [5,6,7,8], 7 [9,10,11,12]], 8 9 [[13,14,15,16], 10 [17,18,19,20], 11 [21,22,23,24]] 12 ] 1 阅读全文

posted @ 2020-09-05 10:55 cltt 阅读(2376) 评论(0) 推荐(0) 编辑

pytorch 不同版本对应的cuda
摘要:参考官网: https://pytorch.org/get-started/previous-versions/ 查看cuda版本:cat /usr/local/cuda/version.txt torch、torchvision、cuda 、python对应版本匹配 如何解决Pytorch的GUP 阅读全文

posted @ 2020-09-02 12:40 cltt 阅读(13757) 评论(0) 推荐(0) 编辑

pytorch 中tensor在CPU和GPU之间转换
摘要:1. CPU tensor转GPU tensor: cpu_imgs.cuda()2. GPU tensor 转CPU tensor: gpu_imgs.cpu()3. numpy转为CPU tensor: torch.from_numpy( imgs )4.CPU tensor转为numpy数据: 阅读全文

posted @ 2020-08-29 10:07 cltt 阅读(2926) 评论(0) 推荐(0) 编辑

1 2 下一页
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示