Bug记录

编程入门 行业动态 更新时间:2024-10-23 02:01:30

<a href=https://www.elefans.com/category/jswz/34/1769739.html style=Bug记录"/>

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记录

本文发布于:2023-11-17 04:02:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636334.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Bug

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!