How to use normal_ with manual seed?

I tried
torch.zeros(5,5).normal_(torch.manual_seed(0), 0.0, 1.0)

but I got the error message:

TypeError: normal_ received an invalid combination of arguments - got (torch._C.Generator, float, float), but expected one of:
* (torch.Generator generator, float mean, float std)
didn’t match because some of the arguments have invalid types: (torch._C.Generator, float, float)

This looks like a very nasty mistake: You accidental have two generator classes incompatible with one another. Can you fix this?

I’m using pytorch 0.3


I think the problem is with the error message, the generator should be a keyword argument: torch.zeros(5,5).normal_(0.0, 1.0, generator=torch.manual_seed(0)) does work.
With the current master, your code raise an error saying that only 2 positional arguments are allowed.

Indeed, your solution works.

I first tried torch.zeros(5,5).normal_(0.0, 1.0, torch.manual_seed(0)). This also failed and told me I should put the generator first.

The solution is that generator must be a keyworded argument, then it works.