Implementing own "batching" method

Hi,

I was wondering how do I change the way batches are created by the dataloader. Many tutorials show how I make my own Dataset class which I can then feed into the dataloader. However, I also want to change how batches are created. For example when the matrices have to be combined in a specific way rather than just stacked onto each other.

Is there something like a tutorial out there?