Solved by fmassa in post #3 
              
              
                I’m not sure I understand everything, but one possibility is to create a class that contains a __call__ method which will be passed to your DataLoader 
class MyCollator(object):
    def __init__(self. *params):
        self.params = params
    def __call__(self, batch):
        # do something with b…