Code error can anyone explain me iam learning now pytorch

TypeError Traceback (most recent call last)
in
1 model_ft = train_model(model_ft, criterion, optimizer_ft, exp_lr_scheduler,
----> 2 num_epochs=30)

in train_model(model, criterion, optimizer, scheduler, num_epochs)
21 # Iterate over data.
22 for inputs, labels in dataloaders[phase]:
—> 23 inputs = inputs.to(device)
24 labels = labels.to(device)
25

TypeError: to() received an invalid combination of arguments - got (type), but expected one of:

  • (torch.device device, torch.dtype dtype, bool non_blocking, bool copy, *, torch.memory_format memory_format)
  • (torch.dtype dtype, bool non_blocking, bool copy, *, torch.memory_format memory_format)
  • (Tensor tensor, bool non_blocking, bool copy, *, torch.memory_format memory_format)

Try to print what device is set to as it seems to be a type while a torch.device or str is expected.