def testShape(self):
     num_dims = 3
     problem_defs = [{
         "name": "simple",
         "options": {}
     } for _ in xrange(num_dims)]
     ensemble = problems.ensemble(problem_defs)
     f = ensemble()
     self.assertEqual(f.get_shape().as_list(), [])
Example #2
0
 def testVariables(self):
   num_dims = 3
   problem_defs = [{"name": "simple", "options": {}} for _ in xrange(num_dims)]
   ensemble = problems.ensemble(problem_defs)
   ensemble()
   variables = tf.trainable_variables()
   self.assertEqual(len(variables), num_dims)
   for v in variables:
     self.assertEqual(v.get_shape().as_list(), [])
Example #3
0
  def testValues(self, value):
    num_dims = 1
    weight = 0.5
    problem_defs = [{"name": "simple", "options": {}} for _ in xrange(num_dims)]
    ensemble = problems.ensemble(problem_defs, weights=[weight])
    f = ensemble()

    with self.test_session() as sess:
      output = sess.run(f, feed_dict={"problem_0/x:0": value})
      self.assertEqual(output, weight * value**2)