Solved by Nikronic in post #2 
              
              
                Hi, 
It looks weird, because I just ran the code using random TensorDataset and it is ok when you can get the length of your dataset, trainset, and valset correctly as you have achieved this too. 
import torch
from torch.utils.data.dataset import TensorDataset, random_split

init_dataset = TensorDat…