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

Commit

Permalink
Add retries to cppn param test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludwig Schubert committed Dec 19, 2018
1 parent e254694 commit 464e13c
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions tests/optvis/param/test_cppn.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ def xor_objective(a):
loss_t = xor_objective(cppn_param)
optimizer = tf.train.AdamOptimizer(0.01)
objective = optimizer.minimize(loss_t)
tf.global_variables_initializer().run()
loss = loss_t.eval()
for i in range(100):
_, vis = sess.run([objective, cppn_param])
close_enough = (
vis[0, 0] > .99
and vis[-1, -1] > .99
and vis[-1, 0] < .01
and vis[0, -1] < .01
)
if close_enough:
return
assert False, "fitting XOR took more than 100 steps, failing test"
for try_i in range(3):
tf.global_variables_initializer().run()
# loss = loss_t.eval()
for i in range(200):
_, vis = sess.run([objective, cppn_param])
close_enough = (
vis[0, 0] > .99
and vis[-1, -1] > .99
and vis[-1, 0] < .01
and vis[0, -1] < .01
)
if close_enough:
return
assert False, "fitting XOR took more than 200 steps, failing test"

0 comments on commit 464e13c

Please sign in to comment.