I’m not clear about what r u trying 2 do in Q1, can u explain more?
collate_fn is the function used to combine a bunch of samples taken from a Dataset to something that can be fed into a module. For instance, if your dataset returns a single tensor with one index, then an acceptable collate_fn could be torch.cat or something that combines these tensors into a batch(usually a bigger tensor).