Hi Raphi!
I don’t know of a way to give the dataset two indicies but I can think of another solution to your problem.
When you initialize your dataset you could build a mapping from a one-dimensional index to your two dimensional index. I wrote some code that hopefully could help you
from torch.utils.data import Dataset


class MyDataset(Dataset):
    def __init__(self, data_file):
        self.data_file = data_file
        self.index_map = {}
        index = 0
        for sample in data_file:  # First dimension
            sample_index = sample['index']
            for timeseries in sample:  # Second dimension
                timeseries_index = timeseries['index']
                self.index_map[index] = (sample_index, timeseries_index)
                index += 1

    def __getitem__(self, idx):
        sample_index, timeseries_index = self.index_map[idx]
        # Use the two indices to get the desired data
        ...