How can I enable pytorch to work on GPU?
I've installed pytorch successfully in google colab notebook:
Tensorflow reports GPU to be in place:
But torch.device function fails somehow:
How can I fix this?
You can enable GPU by clicking on "Change Runtime Type" under the "Runtime" menu. There is also "TPU" support available in these days.
You can define define device
using torch.device
:
import torch
DEVICE = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With