![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
新技能get
每天进步一点点
展开
-
pytorch多卡并行模型的保存与载入
多卡并行模型的保存与载入当模型是在数据并行方式在多卡上进行训练的训练和保存,那么载入的时候也是一样需要是多卡。并且,load_state_dict()函数的调用要放在DataParallel()之后,而model.cuda()苏在的位置无影响。model = DefinedNetwork()model = torch.nn.parallel.DataParallel(model, devic...原创 2019-11-29 11:03:48 · 3399 阅读 · 2 评论 -
python获取一个目录下所有jpg文件
输入:文件夹目录名称输出:以列表形式返回该目录下包括其子目录下所有的后缀名为.jpg的文件名import osdef get_fileNames(rootdir): fs = [] for root, dirs, files in os.walk(rootdir,topdown = True): for name in files: _, ending = ...原创 2018-12-18 14:22:11 · 5849 阅读 · 2 评论