背景
公司内部的基于torch的toolbox发现某个版本之后,结果发生了偏移. 通过一系列排查,发现当导入cupy和torch的顺序不同时,计算结果会有所差异。 也就是说,如下两段代码会导致模型训练等环节的计算得到不同的结果.
阅读更多再次迫于生计。。。
大致的学习路线为:
一: 简单的定向脚本爬虫( request --- bs4 --- re )
二: 大型框架式爬虫( Scrapy 框架为主)
三:浏览器模拟爬虫 ( Mechanize 模拟 和 Selenium 模拟)
阅读更多import os import math ave_err=0.0 max_err=0.0 max_err_rate=0.0 length=0 with open("cpu_result.txt","r") as fp1, open("cuda_ppl_result.txt","r") as fp2: for l1 in fp1: l2 = fp2.readline() l1=l1[:-2] l2=l2[:-2] lst = l1.split(' ') lst2 = l2.split(' ') #print lst lst = [float(x) for …
阅读更多记录一些常用的...总去查文档也是有点麻烦
*
tensor.view 的作用是reshape 比如 a = torch.range(1, 16) 得到一个tensor that has 16 elements from 1 to 16. 在a=a.view(4,4)就得到了一个44的tensor。 需要注意reshape之后元素的个数不能改变(16==44) 参数-1的作用是,我懒得算这一维度应该是多少,(由于元素个数不能改变)所以希望自动被计算。**需要注意的是,只有一个维度可以写-1。 **不过view和reshape有些区别:reshape always copies memory. view never …
阅读更多list = os.listdir(rootdir)#列出目录下的所有文件和目录 for line in list: filepath = os.path.join(rootdir,line) if os.path.isdir(filepath):#如果filepath是目录 print "dir:" + filepath else: print "file:" + filepath
阅读更多。。。哭了哦。。终于解决了这个bug
参考资料:
libgfortran=3.0 should not be install with numpy <= 1.9
[SOLVED] libgfortran.so.3:cannot open shared object file: No such file
[Replacing gcc-libs-libs with gcc-multilib arch
conflict with gcc-libs and gcc-libs-multilib on latest update
一开始以为是anaconda相关。。。搞了半天。。。
阅读更多conda update anaconda 后提示
ValueError: unsupported format character ')' (0x29) at index 49
查到了这个:anaconda update issue
I have narrowed this down to the following packages:
package build psutil-1.2.1 py27_0 hard-link pycparser-2.10 py27_0 hard-link pykit-0.1.0 np18py27_2 hard-link pyparsing-2.0.1 …
阅读更多