Bug记录

那些年写过的很小的bug:
Bug1:

if args.model == 'IRNN' or 'irnn':
    # some code

这实际上不会按你期望的方式工作。原因在于 ‘irnn’ 是一个非空的字符串,因此它在布尔上下文中被视为 True。所以条件总是为真,而不会考虑 args.model 的值。
改:

if args.model == 'IRNN' or args.model == 'irnn':

Bug2:

input_a.cuda().double() AttributeError: ‘numpy.ndarray’ object has no
attribute ‘cuda’

  if(i == 0 and args.channel != 0):
        for i in range(args.channel):
            q.append(input_t.cpu())  
    print(f"qlength:{len(q)}")
    q.popleft()
    q.append(input_t.cpu())
if args.cuda:
        torch.tensor(input_a).to(device=torch.device('cuda')).double()

Bug3:

if args.cuda:
        torch.tensor(input_a).to(device=torch.device('cuda')).double()

改:

if args.cuda:
        input_a = torch.tensor(input_a).to(device=torch.device('cuda')).double()

Linux命令:

zip -r my_archive.zip srcnn -x "fulltrain" "pthres" "respng"

你可能感兴趣的:(bug)