Hello,
I’m trying to implement neuroevolution using PyTorch and I run into a problem when I try to recover the perturbations generated by a gaussian noise
The principle is:
- I start from a base individual
- I create a number of offsprings. For each offspring I:
-
Select a integer seed, using numpy
-
Use torch.manual_seed(numpy_seed)
-
For each tensor in state_dict().values() I create a normal perturbation using:
perturbation = torch.ones_like(v).normal_()
-
Set the new tensor with v.copy_(v + perturbation*std)
- I record only the seed.
- I get fitnesses for all offsprings
- Then, I want to move the base individual in the direction indicated by the rewards.
- Problem arises when I try to recover the perturbation:
For each offspring I:
- Get the corresponding seed, and set torch.manual_seed(this_seed)
- Regenerate the perturbation, which is not the same !
I can’t figure out why. Could someone help ?
In case my explanation weren’t clear, here’s a link to the code:
Thanks a lot !