Hi every one,

I have a Machine learning program, which I was working on it until 2 weeks ago. I ran it on google colab (GPU). after 2 weeks vacation I came back to it and ran without any change.

I got the error: RuntimeError: Can’t call numpy() on Variable that requires grad. Use var.detach().numpy() instead.

I changed the runtime to Local there is no change.

when I download the .jpynb on my PC and run it, there is no error. it seems that there have been some changes on google colab during these 2 weeks.

can you help me to solve this problem?

exact error text:

RuntimeError Traceback (most recent call last)

in ()

29 no_mive_criteria = 0.01,

30 SNR_Lin = SNRs_List_Linear[i],

—> 31 SNR_dB = SNRs_List_dB[i])

32

33 model_save_name = ‘Modelof{}QAMforSNR{}’.format(order,EbN0s_List_dB[i])

8 frames

/usr/local/lib/python3.6/dist-packages/torch/tensor.py in **array**(self, dtype)

490 def **array**(self, dtype=None):

491 if dtype is None:

–> 492 return self.numpy()

493 else:

494 return self.numpy().astype(dtype, copy=False)

RuntimeError: Can’t call numpy() on Variable that requires grad. Use var.detach().numpy() instead.