I have been playing around with your fine example.
Im not sure it works correctly when it comes to changing the stride.
consider the dimensions 407x301x360 and you define a stride of 20 and kernel of 64
According to my calculation that should yield 20x15x18 = 5400 patches. Alas your code only yields 3240 patches.
I might be calculating it wrong.
In my project I create 64x dim patches and when processed through the network they yield 24x dim result patches. These patches needs needs to be created with enough overlapping to capture the entire screening and they need to be put back together in the same order the patches were extracted from the original screening.

patchIllu.png1189×734 34.5 KB

This is a little illustration i made.
The black box is the original screening
the small red boxes are result 24x dim patches
the gray box is a 64x patch.
the different color boxes is an illustration on how the stride has to work