![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pytorch
文章平均质量分 53
Wsyoneself
随遇随记,共同学习,欢迎评论和讨论!
wsywsywsywsywsy979
展开
-
python基础学习(7)
python基础学习(7)原创 2022-12-03 20:49:12 · 913 阅读 · 0 评论 -
pytorch基础学习(6)
pytorch基础学习(6)原创 2022-12-03 20:46:02 · 811 阅读 · 0 评论 -
pytorch基础学习(5)
pytorch基础学习(5)原创 2022-12-03 20:29:27 · 347 阅读 · 0 评论 -
pytorch基础学习(4)
pytorch基础学习(4)原创 2022-12-03 16:53:49 · 702 阅读 · 0 评论 -
pytorch基础学习(3)
pytorch基础学习(3)原创 2022-12-03 16:37:50 · 708 阅读 · 0 评论 -
pytorch基础学习(2)
pytorch基础学习(2)原创 2022-12-03 14:27:30 · 347 阅读 · 0 评论 -
pytorch基础学习(1)
pytorch基础学习(1)原创 2022-12-03 14:16:05 · 644 阅读 · 0 评论 -
TorchScript--初步学习笔记
TorchScript--初步学习笔记原创 2022-11-29 16:59:01 · 386 阅读 · 0 评论 -
Trainer--学习笔记
Trainer--学习笔记原创 2022-11-21 22:20:55 · 622 阅读 · 0 评论 -
pytorch编程知识(2)
torch.gather():从批量tensor中取出指定乱序索引下的数据array 转为tensor:torch.from_numpy()二维tensor转置:tensor = torch.transpose(tensor, dim0=0, dim1=1)原创 2022-06-30 19:15:22 · 845 阅读 · 0 评论 -
torch.load加载模型报错:Can‘t get attribute ‘vae_vc‘ on <module ‘__main__‘ from ‘xxxx()运行文件路径‘
报错原因:torch.load在加载模型时实际需要参考网络结构构建出一个对应网络的实例对象,需要参考源class原创 2022-06-29 09:38:30 · 1262 阅读 · 0 评论 -
RuntimeError: Given groups=1, weight of size [512, 80, 7], expected input[1, 329, 80] to have 80 ch
完整报错:解析错误:无分组卷积,卷积核的输入通道是80,输入通道是512,大小为7(一维卷积)(如果是二维卷积,则此处的size是会有4个数,后两个表示卷积核的大小)实际输入的张量维度是[1,329,80], 即feature的channel 是329,但期望的输入feature的channel为80通道我这边的实际错误是读入input的shape是[329,80],所以仅通过即转置后便解决错误,但如果直接就是不匹配的,要么选择修改网络层的结果(即输入通道设置),要么使用resha原创 2022-06-13 18:38:26 · 3201 阅读 · 3 评论 -
报错‘Adam‘ object has no attribute ‘lr‘或python报错‘Adam‘ object has no attribute ‘learning_rate‘
报错'Adam' object has no attribute 'lr'或python报错'Adam' object has no attribute 'learning_rate'原因:问题可能是package有更新解决:使用optimizer.param_groups[0]['lr']来获取学习率并进行修改原创 2022-03-07 19:27:46 · 5582 阅读 · 0 评论 -
torch.cuda.is_available 返回false
1.问题:2.解决:(1)命令行输入:NVIDIA-smi查看cuda的版本号和电脑驱动版本号是否匹配:参考对比是否匹配:(2)巨坑!!!!:检查自己安装的torch是cpu版本还是GPU版本,如果是CPU版本,需要卸载重装:检查方法:打开cmd输入:pythonimport torchprint(torch.__version__)输出:(有“+cpu”则说明是cpu版本)卸载:有的电脑在后续安装新版本会自动检测卸载,如果不会的,需要..原创 2022-03-14 08:40:58 · 5902 阅读 · 1 评论 -
记录一次pytorch训练模型遇到的报错
记录一次pytorch训练模型遇到的报错(特定代码下的解决,仅供参考)原创 2022-06-20 20:34:57 · 3262 阅读 · 1 评论 -
pytorch 编程知识(1)
1. functools.partial:用于固定(从左到右固定)一个函数的参数,相当于返回一个新函数2. nn.InstanceNorm2d:pytorch中的归一化层 1. 参数: 1. affine如果为True则归一化中使用的参数为可学习的,否则为固定的 2. 如果 track_running_stats 设置为 True ,则在训练过程中该层将继续对其计算的均值和方差进行连续估算,然后将其用于评估期间的标准化。3. lr_scheduler.Lambda原创 2022-06-03 14:45:17 · 632 阅读 · 0 评论 -
GPU上的tensor调用numpy报错:TypeError: can‘t convert cuda:0 device type tensor to numpy. Use Tensor.cpu() t
完整报错:TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.环境:python3,笔记本带cuda原因:numpy只能再cpu上调用,GPU上的tensor不可调用(如何将model,tensor放到GPU上可以参考我的另一篇博客:pytorch将model放置到GPU(cuda)上,运行时报错Expected al原创 2022-05-04 09:43:26 · 4164 阅读 · 0 评论 -
pytorch将model放置到GPU(cuda)上,运行时报错Expected all tensors to be on the same device, but found at least tw
完整报错:Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument index in method wrapper__index_select)环境:python3,游戏本(带gpu)1. 将model放置到cuda上:USE_CUDA = torch.cuda.is_available()原创 2022-05-04 09:10:08 · 8438 阅读 · 0 评论 -
python 报错:AttributeError: module ‘torch.utils.data.dataset‘ has no attribute ‘MNIST‘
或者报错AttributeError: module 'torch.utils.data' has no attribute 'datasets'原因:导包错误原创 2022-03-31 14:10:03 · 3150 阅读 · 0 评论