the code is
inputs.cuda()
targets.cuda()
print(inputs.device)
print(targets.device)
but the output is :
cpu
cpu
the code is
inputs.cuda()
targets.cuda()
print(inputs.device)
print(targets.device)
but the output is :
cpu
cpu
The .cuda()
operation is not in place so you need to store the returned GPU tensor. Like so:
inputs = inputs.cuda()
targets = targets.cuda()
Notice that this operation is in place for models: e.g., model.cuda()
will work as expected, you don’t have to do model = model.cuda()