C2_W1_Lab02_CoffeeRoasting_TF: tf.random.set_seed AND load previous weights (why don't we just use the calculated weights)

My questions are

  1. tf.random.set_seed(1234) # applied to achieve consistent results;
    How does set_seed work? How could it keep results reproducible no matter how many times I run through the code?

  2. While set_seed can keep the result weights reproducible, why don’t we just use the calculated weights for the following process? Why does it load some numbers that I don’t know where they come from?

  3. Why does it matter if the following results differ? I tried to run the following code using different weights. The only result that would change is the values of predictions. What is the matter if this changes?

Thank you very much.


You can check what set_seed does in tensorflow website (search in Google the entire function name), it basically works like seed in python.

Sometime in Tensorflow weights and/or other parameters are initialized randomly and may produce different outcome in different runs.

Precisely because you want to obtain the same predictions all the times thats why you would used seed, it might be the case the assignment wants to show consistency.