In my case, the same code worked with 0.2.0, but segfault with 0.4.
I changed my random number generation as smth guided, it works properly now 
I think you can try torch’s normal_() (or other random number functions), since 0.4 has advantages.
Thank you.