code: def test_cppn_fits_xor():
      with tf.Graph().as_default(), tf.Session() as sess:
          cppn_param = cppn(16, num_output_channels=1)[0]
  
          def xor_objective(a):
              return -(
                  tf.square(a[0, 0])
                  + tf.square(a[-1, -1])
                  + tf.square(1.0 - a[-1, 0])
                  + tf.square(1.0 - a[0, -1])
              )
  
          loss_t = xor_objective(cppn_param)
          optimizer = tf.train.AdamOptimizer(0.01)
          objective = optimizer.minimize(loss_t)
          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] > 0.99
                      and vis[-1, -1] > 0.99
                      and vis[-1, 0] < 0.01
                      and vis[0, -1] < 0.01
                  )
                  if close_enough:
                      return
          assert (
              False
          ), "fitting XOR took more than 200 steps, failing test"
  
imports: from __future__ import absolute_import, division, print_function
  import pytest
  import numpy
  import tensorflow
  import logging
  from lucid.optvis.param.cppn import cppn
label_desc: Use image node_id 1 for calling a global function with example usage: test_cppn_fits_xor() and returns: unknown