Skip to content

Commit 895d11d

Browse files
SquadrickWindQAQ
authored andcommitted
Set random seed for TensorFlow to make test repro (#685)
1 parent c394b55 commit 895d11d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tensorflow_addons/optimizers/lookahead_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
class LookaheadTest(tf.test.TestCase):
3030
def run_dense_sample(self, iterations, optimizer, seed=0x2019):
3131
np.random.seed(seed)
32+
tf.random.set_seed(seed)
3233

3334
val_0 = np.random.random((2,))
3435
val_1 = np.random.random((2,))
@@ -56,6 +57,7 @@ def run_dense_sample(self, iterations, optimizer, seed=0x2019):
5657

5758
def run_sparse_sample(self, iterations, optimizer, seed=0x2019):
5859
np.random.seed(seed)
60+
tf.random.set_seed(seed)
5961

6062
val_0 = np.random.random((2,))
6163
val_1 = np.random.random((2,))
@@ -109,6 +111,7 @@ def test_sparse_exact_ratio(self):
109111

110112
def test_fit_simple_linear_model(self):
111113
np.random.seed(0x2019)
114+
tf.random.set_seed(0x2019)
112115

113116
x = np.random.standard_normal((100000, 3))
114117
w = np.random.standard_normal((3, 1))

0 commit comments

Comments
 (0)