I’m not sure why would the sampler need to create a namedtuple, since obtaining the number of namedtuples in the Dataset would suffice for generating random indices over them.
For batching the DataLoader should created a new namedtuple such that each element in the orginal corresponds to a tensor of batch size in the new one (as you have illustrated in the example).