My code is:
for i, (data, label) in data_gen:
data = data.to(device)
label = label.to(device)
outputs = model_ft(data)
_, preds = torch.max(outputs, 1)
for t, p in zip(label.view(-1), preds.view(-1)):
print(t, p)
confusion_matrix[t.long(), p.long()] += 1
Error message is
‘torch.FloatTensor’ object has no attribute ‘to’