美文网首页
Debug记录

Debug记录

作者: 张张大白 | 来源:发表于2020-05-29 15:56 被阅读0次

排版要求:注意图都是1500*x

未完待续


【1-已解决】Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same

两个输入不匹配,一个在GPU一个在CPU

【2-已解决】pytorch 出现forward() missing 1 required positional argument: 'x’


前面实例化类命名的时候,要避免重复Net=Net()这种,否则后面再实例化时会出错,不认得类Net

【3-已解决】 f.write(f'{i}\n')# write() 方法用于向文件中写入指定字符串。

UnicodeEncodeError: 'gbk' codec can't encode character '\xa5' in position 103: illegal multibyte sequence
指定识别unicode字符

    with open(tgt_path, 'w+', encoding="utf-8") as f:
        for i in tgt:
            f.write(f'{i}\n')

【4-已解决】python 出现'matplotlib' has no attribute 'imshow'错误

首先确自己正确安装了matplotlib库
查看自己的import
正确写法应该是from matplotlib import pyplot as plt, 再使用plt.imshow()方法
而不是直接import matplotbib后就使用plt.imshow()方法
plt.imshow()函数负责对图像进行处理,并显示其格式,但是不能显示。
其后跟着plt.show()才能显示出来。

【5-已解决】

相关文章

网友评论

      本文标题:Debug记录

      本文链接:https://www.haomeiwen.com/subject/uxvnwhtx.html