Missing `Torch::Generator`
c4lliope opened this issue · comments
Calliope commented
In PyTorch I can use a random generator, such as:
g = torch.Generator().manual_seed(2147483647)
p = Torch.tensor([0.2, 0.6, 0.2])
ix = torch.multinomial(p, num_samples=1, replacement=True,generator=g).item()
Is there a recommended approach for using the generator, including methods like multinomial
?
Andrew Kane commented
Hey @c4lliope, thanks for reporting! Added in the commit above (note that p
must be a tensor in the latest PyTorch).
Calliope commented
Amazingly quick response! In all my years of open-source,
I really need to praise your upkeep here.
I hope you keep making this essential library accessible in Ruby,
so machine learning can be approached easily by more people.
Andrew Kane commented
No problem. Let me know if you run into anything else that's missing.