Traceback (most recent call last):
File "main.py", line 100, in <module>
main()
File "main.py", line 83, in main
train_cateModels(args, cate_data, plot_title, key="")
File "C:\Users\ying\Desktop\DeepGBM\experiments\train_models.py", line 116, in train_cateModels
opt, args.max_epoch, args.batch_size, 1, key)
File "C:\Users\ying\Desktop\DeepGBM\experiments\helper.py", line 168, in TrainWithLog
test_loss, pred_y = EvalTestset(test_x, test_y, model, args.test_batch_size, test_x_opt)
File "C:\Users\ying\Desktop\DeepGBM\experiments\helper.py", line 89, in EvalTestset
return sum_loss / test_len, np.concatenate(y_preds, 0)
File "C:\Users\ying\Miniconda3\lib\site-packages\torch\tensor.py", line 458, in __array__
return self.numpy()
TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Solution:
y_preds.append(outputs) -> y_preds.append(outputs.cpu())