I think this post 5 might be useful, which explains how to use unfold to create patches of the input and how to reshape them back.
Let me know, if this approach would be applicable for your use case and please let me know, if you get stuck implementing it. 
Also, since you are working with medical image data, have a look at MONAI and TorchIO 1.
I know, that MONAI supports a sliding window inference workflow 4, but I’m unsure if it’s usable for training or if TorchIO supports it.
CC @MONAI, @fepegar for more information