In Python, we create and seed a random generator like this
gen = torch.Generator()
gen.manual_seed( 42 )
to be used for example in
x = torch.multinomial( x, num_samples=1, generator=gen )
Now, I would like to do the same thing in C++. So, I tried
auto gen = torch::Generator();
gen.manual_seed( 42 ); // Does not exist !!!
but the method manual_seed does not exist.
I found another method called set_current_seed but it crashes at execution!
auto gen = torch::Generator();
gen.set_current_seed( 42 ); // Crashes !!!
Any idea ?