You can use torch’s DataLoader to iterate over timeseries, and in addition manually sample random time offsets. This can be done inside collate_fn (see collate_batch in cell 20 here as an example of collate_fn, though it is a bit different - full sequences are padded). Or inside __iter__ (IterableDataset), that’s more conventional way.