Is there any way to find the seed used for initialization?

I implemented my code and got good results. Is there any way to find out which seed is used for my results on server code? I didn’t set the seed manually and want to make sure I can reproduce the results.


You can use torch.seed() to get the current seed.
You might want to check the reproducibility part of the doc though: as having the seed most likely won’t allow you to reproduce the result if you’re using a different machine or using ops that are not deterministic.

1 Like

Can you say that what exactly manual.seed() shows? When I set seed at the start of the initialization function, and print torch.seed() for two similar networks, I give bunch of different numbers, but I think since it’s set at the start of the function, any initialization with that seed must be unique. Am I right?

You can check the doc here. It returns the value used to initialize the random number generator.
You can also use get/set rng state (

1 Like

I just read the reproducibility, and it seems torch.seed() is to set the seed randomly, not to get the current seed.