pytorch
zzw小凡
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
pytorch 使用预训练层
pytorch 使用预训练层将其他地方训练好的网络,用到新的网络里面pytorch 使用预训练层 加载预训练网络 加载新网络 更新新网络参数加载预训练网络1.原先已经训练好一个网络 AutoEncoder_FC() 2.首先加载该网络,读取其存储的参数 3.设置一个参数集cnnpre = AutoEncoder_FC() cnnpre.load_state_dict(torch.load('au原创 2017-11-23 09:45:13 · 1716 阅读 · 1 评论 -
Pytorch Variable Tensor Numpy 之间的转换
1 tensor 转 numpya = torch.FloatTensor(3,3)print a.numpy()2 numpy 转 tensora = np.ones(5)torch.from_numpy(a)3 Variable 转 numpya = Variable(torch.FloatTensor(3,3))print a.data.numpy()3 numpy 转 Variablea...原创 2018-05-15 11:10:36 · 12562 阅读 · 0 评论 -
Pytorch tried to construct a tensor from a int , but found an item of type numpy.int32
Pytorch 需要 int 类型的数据, 1.astype import numpy as np arr = np.array([1,2,3,4,5]).astype(int) print(arr.dtype) ## int32 输出的int32 并不是 pytorch 需要的类型 2.np.int64() import numpy as np arr = np.int64(np....原创 2018-07-27 17:50:23 · 975 阅读 · 0 评论 -
Pytorch Multi GPU 使用
1 检测torch 是否支持gpu import torch print(torch.cuda.version) #查看cuda版本 print(torch.cuda.is_available()) #查看pytorch 是否能用 cuda --9.0.176 --True 如果输出为true 就为可用,如果只有版本号,且输出为False,则需要重新装一下显卡的驱动 2 前向计算 device...原创 2019-06-20 16:28:38 · 1191 阅读 · 0 评论
分享