DataLoader batch parameter - vision - PyTorch Forums
discuss.pytorch.org › t › dataloader-batch-parameterNov 03, 2018 · Each sample in a batch of data is an array. For a given batch, I only want to get a single index of the array. Essentially, I want to go from N, K, C, H, W to N, C, H W by randomly sampling a value between [0, K] for each batch. How do I accomplish this using DataLoader? I think it’s either a collate_fn or a worker_init_fn. I need this to run before getitem ideally.