cuda为True时候调用cuda().data.cpu().numpy().tolist()方法,CPU时候调用numpy().tolist()方法
if args.cuda:
pred_labels = preds.cuda().data.cpu().numpy().tolist()
else:
pred_labels = preds.numpy().tolist()
Expected object of device type cuda but got device type cpu for argument #3 'weight' in call to
解决办法:
self.alpha_t = torch.tensor(alpha_t).cuda() if alpha_t else None
查看centos下文件夹对应文件大小
du -sh *
清空缓存
echo 3 >/proc/sys/vm/drop_caches