Solved by ptrblck in post #2 
              
              
                Skimming through your code it looks like the padding in your PyTorch approach might be wrong. 
If I’m not mistaken you are using a 3D ([9x9x9]) conv kernel. To get the same volumetric output as your input, you should use padding=4 for stride=1.