I am actually still unsure how to use it on my dataset. Now I have the code written that gets the training and validation indices and weights.

# build the dataset
dset = TrajectoryDataset(
    path,
    obs_len=args.obs_len,
    skip=args.skip)

# indices
dset.train_indices # indices of the training set
dset.valid_indices # indices of the validation set
dset.train_weights # sample weights for the training set
dset.valid_weights # sample weights for the validation set

But I am not sure what to pass into the DataLoader function. You created a TensorDataset with data[subset_idx] but I have my own dset because I need my own getitem method. I can’t pass dset[dset.train_indices].