Solved by vdg in post #2 
              
              
                It seems the default constructor torch::Generator() leaves the pointer to GeneratorImpl a nullptr. 
I took another route and fixed it using: 
auto cpu_gen = at::detail::createCPUGenerator();
{
    std::lock_guard<std::mutex> lock(cpu_gen.mutex());
    cpu_gen.set_current_seed(0);
}
std::cout<<"gen_c…