def test_struct_placeholders(self): obj = ([4], CenteredGrid([1, 4, 1], box[0:1], content_type=struct.shape), ([9], [8, 2])) tensorflow.reset_default_graph() p = placeholder(obj) self.assertEqual('Placeholder/0:0', p[0].name) self.assertEqual('Placeholder/1/data:0', p[1].data.name) self.assertIsInstance(p, tuple)
def test_struct_placeholders(self): bounds = box[0:1] # outside unsafe with struct.unsafe(): obj = ([4], CenteredGrid([1, 4, 1], bounds), ([9], [8, 2])) tensorflow.reset_default_graph() p = placeholder(obj) self.assertEqual(p[0].name, '0:0') self.assertEqual(p[1].data.name, '1/data:0') self.assertIsInstance(p, tuple)
def test_direct_placeholders(self): tensorflow.reset_default_graph() p = placeholder([4]) self.assertIsInstance(p, tensorflow.Tensor) numpy.testing.assert_equal(p.shape.as_list(), [4]) self.assertEqual(p.name, 'Placeholder:0') v = variable(math.zeros([2, 2])) numpy.testing.assert_equal(v.shape.as_list(), [2, 2]) self.assertIsInstance(v, tensorflow.Variable) self.assertEqual(v.name, 'Variable:0')