Hi,
Try to send opt to cuda using .cuda()



 Jaredeco:

opt = optim.Adam(net.parameters())


Also, Variable has been removed from PyTorch for few last versions. You can directly send tensors to GPU using inputs = inputs.cuda().
Also, could you close the other post as it is same question at the same time?

  
    
    
    Pytorch using 1% of GPU the training is slow almost like on Cpu 
  
  
    Cuda is almost not using GPU when training model .to(device) not working on tensors. I tried increasing batch size nothing helps. 
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import transforms
from torchvision import datasets
torch.cuda.is_available()
#True
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
#cuda


train_path = r'D:\Datasets\fruits\5857_1166105_bundle_archive\fruits-360\Training'
transform =  transforms.Compose([
    tra…