----> 2 images=images.to(device)
3 labels=labels.to(device)
RuntimeError:CUDA error: device-side assert triggered error
that is exactly the error I am getting
and this is the code causing it:

total_loss = 0
total_correct=0
for batch in testloader:
images, labels = batch
images=images.to(device)
labels=labels.to(device)
preds = net(images)
loss = loss_function(preds,labels)
total_loss += loss.item()
total_correct += get_correct(preds, labels)