Do you want overlapping windows or unique ones?
If overlapping is OK, you could just use the shuffled indices and slice your data.
Otherwise you could use something like this:
class MyDataset(Dataset):
def __init__(self, window=10):
self.data = torch.arange(100).view(-1, 1).expand(-1, 10)
self.window = window
def __getitem__(self, index):
index = index * self.window
x = self.data[index:index+self.window]
return x
def __len__(self):
return len(self.data) / self.window
dataset = MyDataset(window=10)
print(dataset[0])