After I deteleted the code of ‘requires_grad=True’, similar error occured as
There is only one GPU
Traceback (most recent call last):
File “train.py”, line 123, in 
test_train.start_train(epoch=30,batch_display=2000,batch_size=50,save_freq=1)
File “train.py”, line 96, in start_train
pcc = scipy.stats.pearsonr(gtlabel, output.squeeze(-1))[0]
File “/home/simon/anaconda3/lib/python3.6/site-packages/scipy/stats/stats.py”, line 3003, in pearsonr
y = np.asarray(y)
File “/home/simon/anaconda3/lib/python3.6/site-packages/numpy/core/numeric.py”, line 492, in asarray
return array(a, dtype, copy=False, order=order)
File “/home/simon/anaconda3/lib/python3.6/site-packages/torch/tensor.py”, line 376, in array
return self.cpu().numpy()
RuntimeError: Can’t call numpy() on Variable that requires grad. Use var.detach().numpy() instead.