Hi All,
I was trying to the run the benchmark code in google colab, But I was run into problem . could please anyone help me to solve this.
here my error.
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Tensors on CUDA cannot be converted to numpy directly. You need to manually move it to CPU first.
The solution is exactly what is error description says: x.detach().cpu().numpy().
@suresh12 were you able to solve it? I am still facing the issue after changing the line return preds.detach().numpy().squeeze() to return preds.to(‘cpu’).detach().numpy().squeeze()
Do we have to change somewhere else to? can you share the code snippet which you changed @polymathAB