The to() operation is not an in-place op for tensors, so you would need to reassign it:
example_data = example_data.to(device)




 Vatsal_Malaviya:

Can anyone please verify whether for binary classification what should be dimensions of last linear layer should it be torch.nn.Linear(64,1) or I need to change to torch.nn.Linear(64,2)


For nn.BCELoss or nn.BCEWithLogitsLoss the former shape of [batch_size, 1] is expected.
You could use the output shape of [batch_size, 2] in case you want to apply a multi-class classification to this binary use case, which could be applied via nn.CrossEntropyLoss.