Multithreading Segmentation fault

it should be thread-safe, and if it’s not, we will fix it.

I’ve tested your example against the master branch of pytorch, and it did not produce segfaults.
I wonder if we fixed the issue you are seeing already.
Can you give the master branch a try to confirm?