I am learning how to build a LeNet5 CNN using pytorch. There is warning says 'Unresolved attribute reference ‘to’ for class ‘int’ ’ I dont know how to deal with it. Here is the code with warning at images = images.to(device)
for epoch in range(num_epochs):
for i, (images, labels) in enumerate(train_loader):
images = images.to(device)
labels = labels.to(device)
outputs = model(images)
loss = cost(outputs, labels)
optimizer.zero_grad()
loss.backward()
optimizer.step()
if (i + 1) % 400 == 0:
print('Epoch [{}/{}], Step [{}/{}], Loss: {:.4f}'
.format(epoch + 1, num_epochs, i + 1, total_step, loss.item()))