Pytorch
yunxiaoMr
where there great love,there are always miracles!Just work hard and be yourself, and then you will succeed!
展开
-
小石子砸出巨坑的故事
小石子砸出巨坑的故事,踩坑之路,慢慢记录~原创 2022-08-25 23:45:44 · 240 阅读 · 1 评论 -
Pytorch:多块GPU调用细节问题及Pytorch的nn.DataParallel解释
我们用实验室带有多块卡的GPU服务器,当我们在上面跑程序的时候,当迭代次数或者epoch足够大的时候,我们通常会使用nn.DataParallel函数加入以下代码段来用多个GPU来加速训练。device_ids = [0, 1]net = torch.nn.DataParallel(net, device_ids=device_ids)然鹅,也常常会由于正在运行程序的0卡显存不够放不下我们新来的模型初始化数据而导致显存OOM的问题不断,使得模型无法训练,同时报出警告:UserWarning原创 2021-01-29 00:35:07 · 7748 阅读 · 3 评论 -
工程项目便利集锦
【1】Ubuntu16.04下使用virtualenv创建各版本python的虚拟环境原创 2021-01-14 21:26:16 · 319 阅读 · 0 评论 -
CCF-CSP 20200604 1246
我就是个猪头肉,把一道动态规划的题暴力求解,28分,随后有时间再优化做~ 呜呜呜import mathimport reif __name__ == '__main__': n = input() string_num = input() n = int(n) cnt = 1 in_str = "2" while(cnt<n): new_str = "" for i in range(len(in_str).原创 2020-12-09 21:39:43 · 156 阅读 · 0 评论 -
Pytorch(四):神经网络结构的调整
经过3000个epoch的训练,我发现模型的loss、精度效果明显趋于稳定。有实验结果可知,测试集的精度已经趋于稳定,在模型参数调好的前提下,说明再优化参数是达不到提升了;另外考虑到该网络还有不合理之处,因此对该网络进行了结构调整。...原创 2020-08-22 19:46:13 · 1421 阅读 · 0 评论 -
Pytorch(三):参数学习率的调整
预备内容经过pytorch(一):torch构建数据集并训练一个神经网络,构建了一个神经网络。其中网络的架构如下:Layer Layer (type) Output Shape 0 (input) [2, 1, 8, 8] 1 Conv2d [2, 4, 9, 9] 2 ReLU [2, 4, 9, 9] 3 MaxPool2d [4, 4, 4, 4] 4 Conv2d [4, 8, 5, 5] 5.原创 2020-08-21 19:05:01 · 5054 阅读 · 2 评论 -
Pytorch(二):torch常用API应用及详解
目录torch常用API1.torch.max(x,dim=1)1.1定义1.2exampletorch常用API1.torch.max(x,dim=1)1.1定义 input输入的是一个tensor dim是max函数索引的维度0/1,0是每列的最大值,1是每行的最大值 返回的是两个值:一个是每一行最大值的tensor组,另一个是最大值所在的位置 max_col_value = torch.max(x,dim=0)[0] # 每一...原创 2020-08-21 12:55:59 · 1196 阅读 · 0 评论 -
pytorch(一):torch构建数据集并训练一个神经网络
预备知识torch.utils.data.DataLoader使用方法 加载手写数据集load_digits() sklearn的train_test_split()的参数含义解释原创 2020-08-20 21:58:35 · 2566 阅读 · 1 评论