- 博客(17)
- 收藏
- 关注
原创 python3和python2不同导致的错误
TypeError: slice indices must be integers or None or have an __index__method解决:在python3 中的列表转换时,其起始和结束都需为整型TypeError: 'float' object cannot be interpreted as an integer解决:python3的/运算结果为float型py...
2018-10-21 19:47:12
510
原创 python3和Python2 中库的转换
python3 没有cPickle,可使用pickleimport pickle as cPickle
2018-10-15 20:54:44
802
原创 caffe-gpu+Pytorch
Linux1.安装Pytorch2.用Anaconda安装caffeconda install caffe-gpu运行代码报错1:Failed to include caffe_pb2, things might go wrong!Traceback (most recent call last):File "train_cls.py", line 105, in <modu...
2018-10-12 21:41:43
633
1
原创 python[::-1]和[-1]用法
[::-1] 顺序相反操作 [-1] 读取倒数第一个元素 [3::-1] 从下标为3(从0开始)的元素开始翻转读取 eg: a=[1,2,3,4,5] b=a[::-1] [5, 4, 3, 2, 1] b=a[-1] 5 b=a[3::-1] [4, 3, 2, 1]...
2018-08-31 20:31:24
119948
转载 Deep Learning 最优化方法
链接:https://blog.youkuaiyun.com/BVL10101111/article/details/72615961
2018-06-21 09:23:17
322
原创 pytorch警告解决方案
安装的pytorch版本: 遇到的问题: 1.UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number losses.update(loss.data[0...
2018-06-08 19:30:16
5919
原创 pytorch之numpy,tensor,variable转换
1.将numpy矩阵转换为Tensor张量locs= torch.from_numpy(loc) #loc为numpy类型 2.将Tensor张量转化为numpy矩阵locs1 = locs.numpy() 3.将numpy转换为Variablelocs2= Variable(torch.from_numpy(locs1)) 4.将Varia...
2018-06-07 21:55:43
1989
转载 Pytorch之指定GPU
转自:http://www.cnblogs.com/darkknightzh/p/6836568.html PyTorch默认使用从0开始的GPU,如果GPU0正在运行程序,需要指定其他GPU。有如下两种方法来指定需要使用的GPU。1. 类似tensorflow指定GPU的方式,使用CUDA_VISIBLE_DEVICES。1.1 直接终端中设定:CUDA_VISIBLE...
2018-06-02 20:05:00
661
原创 Pytorch之GPU模型加载在CPU上
直接在GPU上加载: pretrain = torch.load(opt.pretrain_path) model.load_state_dict(pretrain['state_dict'])将GPU模型加载在CPU上: pretrain = torch.load(opt.pretrain_path, map_location=lambda storage, loc: stora...
2018-06-02 17:30:41
8644
1
转载 转载
转载: https://blog.youkuaiyun.com/dcrmg/article/details/79503978 pytorch允许把在GPU上训练的模型加载到CPU上,也允许把在CPU上训练的模型加载到GPU上。CPU->CPU,GPU->GPU[python] view plai...
2018-05-30 22:29:46
296
原创 Pytorch之ActionRecognition的3DCNN遇到的问题
1.RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes’ failed. 检查类别数目
2018-05-30 17:40:00
1510
原创 Pandas读取csv数据
读取某一列数据 对于以下数据: OQCIHTU0,WeavingBasket,train 506TG9Y4,WeavingBasket,train C76O3DJ4,WeavingBasket,train RXSBPZ3H,WeavingBasket,train 2YOTMIPS,WeavingBasket,train Z3YSBI6H,WeavingBasket,train 采用...
2018-05-30 10:18:36
1115
原创 Linux之PyTorch安装
使用 Virtualenv 进行安装: 1.创建Virtualenv 环境 virtualenv –system-site-packages -p python3 pytorch # for Python 3.n 2.激活 Virtualenv 环境 $ source ~/tensorflow/bin/activate 3.在pytorch官网根据对应版本安装(https://pyt...
2018-05-29 15:10:19
2318
原创 Linux的Shell脚本
1.写为filename.sh文件 2.将其改为可执行文件:chmod +x filename.sh 3.执行脚本./filename.sh
2018-05-29 09:19:34
168
原创 MATLAB 之sort()函数和sortrows()函数
sort():对一维向量进行排序 sortrows():对按某一列数值,改变矩阵中整行的排列位置 p=sortrows(matrix,Row) %matrix 为要排序的矩阵。Row表示按第几列进行排序,整数代表升序,负数代表降序。...
2018-04-09 17:08:39
5710
转载 MATLAB之reshape函数
a=[1 2 3;4 5 6;7 8 9;10 11 12] b=reshape(a,2,6) a = 1 2 3 4 5 6 7 8 910 11 12b = 1 7 2 8 3 9 4 10 5 11 6 12reshape 按列读取: 先把矩阵
2018-01-09 21:35:22
1116
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人