Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a random seed on TF 2.0

I have just upgraded from TF 1.13 to TF 2.0, and my interpreter is complaining because tf.set_random_seed does no longer exist.

What is the equivalent functionality in TF 2.0 ?

like image 959
Jsevillamol Avatar asked Apr 28 '19 13:04

Jsevillamol


People also ask

Why do we set random seed in TensorFlow?

This is to ensure different sequences of random numbers are generated each time the code is run, by default. This seed can also be specified with a specific number, such as “1”, to ensure that the same sequence of random numbers is generated each time the code is run.

What is random set seed?

A random seed is a starting point in generating random numbers. A random seed specifies the start point when a computer generates a random number sequence. This can be any number, but it usually comes from seconds on a computer system's clock (Henkemans & Lee, 2001).

Why do we set random seed?

The seed() method is used to initialize the random number generator. The random number generator needs a number to start with (a seed value), to be able to generate a random number. By default the random number generator uses the current system time.

What is set seed in TensorFlow?

Operations that rely on a random seed actually derive it from two seeds: the global and operation-level seeds. This sets the global seed. Its interactions with operation-level seeds is as follows: If neither the global seed nor the operation seed is set: A randomly picked seed is used for this op.


1 Answers

Found it: tf.random.set_seed is what I was looking for

like image 157
Jsevillamol Avatar answered Oct 06 '22 07:10

Jsevillamol