List object has no attribute 'to'

Hello,
when doing:

   for images,labels in train_loader:
         labels = torch.from_numpy(np.asarray(labels))
         steps+=1
         images, labels = images.to(device), labels.to(device)
         optimizer.zero_grad()
         logps = model(images)
         loss = criterion(logps,labels)
         loss.backward()
....

I got the following error now