Solved by evilgras in post #3 
              
              
                Update: I managed to avoid the segfault when calling zero_tensor in my module. The trick was to add an import torch to my python script! 
Previously, my python script looked like this: 
#!/usr/bin/python3
import dummy

dummy.zero_tensor(3,4,5)

(here, dummy is the name of my module). The above scrip…