I’m not sure how your data is stored, as the first error message points to an integer scalar value, while it now seems to be a Dataset class?
Could you print(type(data)) after indexing it from tgt_dataset_root?