摘要:
错误报在了forward里的Conv2d处。原因是函数写在forward里可能默认cpu,如果写在init构造函数里,就不需要再指定cuda。 修改为箭头指示就不再报错了。 【参考】 Input type (torch.cuda.FloatTensor) and weight type (torch 阅读全文
摘要:
import glob import re for txtFile in glob.glob('./txt/*.txt',recursive=False): #遍历文件夹里的txt文件,不递归子文件夹 file=open(txtFile,'r') content=file.read() matche 阅读全文