shlogg · Early preview
Super Kai (Kazuya Ito) @superkai_kazuya

How To Set A Specific Seed For PyTorch Random Number Generators

manual_seed() sets a specific seed for random numbers. Use it before each generator to get the same results.

Buy Me a Coffee☕
*My post explains how to create and acceess a tensor.
manual_seed() can set a specific seed to generate the same random numbers as shown below:
*Memos:

initial_seed() can be used with torch but not with a tensor.
The 1st argument with torch is seed(Required-Type:int, float, bool or number of str).
A positive and negative seed is different.
You must use manual_seed() just before a random number generator each time otherwise the same random numbers are not generated.
The effect of manual_seed() lasts until manual_seed() or seed() is used next time. *seed() is explained at the...