Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Commit 464e13c

Browse files
author
Ludwig Schubert
committed
Add retries to cppn param test
1 parent e254694 commit 464e13c

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

tests/optvis/param/test_cppn.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@ def xor_objective(a):
3030
loss_t = xor_objective(cppn_param)
3131
optimizer = tf.train.AdamOptimizer(0.01)
3232
objective = optimizer.minimize(loss_t)
33-
tf.global_variables_initializer().run()
34-
loss = loss_t.eval()
35-
for i in range(100):
36-
_, vis = sess.run([objective, cppn_param])
37-
close_enough = (
38-
vis[0, 0] > .99
39-
and vis[-1, -1] > .99
40-
and vis[-1, 0] < .01
41-
and vis[0, -1] < .01
42-
)
43-
if close_enough:
44-
return
45-
assert False, "fitting XOR took more than 100 steps, failing test"
33+
for try_i in range(3):
34+
tf.global_variables_initializer().run()
35+
# loss = loss_t.eval()
36+
for i in range(200):
37+
_, vis = sess.run([objective, cppn_param])
38+
close_enough = (
39+
vis[0, 0] > .99
40+
and vis[-1, -1] > .99
41+
and vis[-1, 0] < .01
42+
and vis[0, -1] < .01
43+
)
44+
if close_enough:
45+
return
46+
assert False, "fitting XOR took more than 200 steps, failing test"

0 commit comments

Comments
 (0)