![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python学习问题及总结
wozhiukbench
这个作者很懒,什么都没留下…
展开
-
Expected tensor for argument #1 ‘input‘ to have the same type as tensor for argument #2 ‘weight‘; bu
这种错误就是tensor的数据类型不匹配.使用type()转化成同一数据类型即可 if reverse: x = XL.reshape(6,384,1,1).type(torch.float32)原创 2022-04-21 19:39:55 · 688 阅读 · 0 评论 -
Python中的*args和**kwargs
https://www.jianshu.com/p/0ed914608a2c转载 2021-11-02 13:59:47 · 113 阅读 · 0 评论 -
kwargs
kwargs就是当你传入key=value是存储的字典。补充一下:kwargs不影响参数位置例子:def test(a,*args,**kwargs):print a#print b#print cprint argsprint kwargstest(1,2,3,d=‘4’,e=5)输出结果:1(2, 3){‘e’: 5, ‘d’: ‘4’}原文在:https://www.cnblogs.com/zhangzhuozheng/p/8053045.html...转载 2021-04-18 12:40:12 · 196 阅读 · 0 评论 -
conda的基本操作
conda info --envs查看环境conda activate pytorch进入"pytorch"环境原创 2021-04-01 16:08:41 · 1826 阅读 · 0 评论 -
爬取wall.alphacoders里一页的图片
import requestsfrom lxml import etreeif __name__ == '__main__': # if not os.path.exists('./4Ktupian'): # os.mkdir('./4tupian') # 第一步 headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTM原创 2020-11-09 14:21:25 · 1436 阅读 · 0 评论 -
pycharm快捷键
想知道函数在文件内的defintion。使用ctrl+鼠标,查看定义原创 2020-10-13 16:12:25 · 93 阅读 · 1 评论 -
python学习问题:包调用
python有个主函数概念,意思是指运行的.py文件就是主函数,运行它会县运行该.py文件导入的包路径所有的__init__内容。高层调用低层可以使用相对寻址(使用点来from import)主函数+对同层的相对寻址:不可用点来from importfrom哪里调用其中函数,就会把那里的所有代码全部执行了...原创 2020-08-04 16:33:59 · 104 阅读 · 0 评论