Thanks Michael,
my approach would be
train_size = int(0.8 * len(D))
test_size = len(D) - train
train, test = torch.utils.data.random_split(D, [train_size, test_size])

instead of
train, test = D[:round(len(D)*1)], D[round(len(D)*0.2):]

Unfortunately, this doesn’t work if I try to implement it in my program. How could I fix this?
Thanks for your answer