I only added it to the first term, img.to(device) and it gave an error, code:
for idx, (img.to(device), label_attr, label_idx) in enumerate(final_train_generator):

Error:
  File "<ipython-input-9-fff104645c7f>", line 18
    for idx, (img.to(device), label_attr, label_idx) in enumerate(final_train_generator):
            ^
SyntaxError: can't assign to function call