Exemplo n.º 1
0
 def test_ndim(self):
     for ndim in range(10):
         res = list(itertools.islice(integers_ndim(ndim), 0, 2))
         generator = GeneratorAdapter(integers_ndim(ndim))
         gop = GeneratorOp(generator)()
         f = theano.function([], gop)
         assert ndim == res[0].ndim
         np.testing.assert_equal(f(), res[0])
         np.testing.assert_equal(f(), res[1])
Exemplo n.º 2
0
 def test_basic(self):
     generator = GeneratorAdapter(integers())
     gop = GeneratorOp(generator)()
     assert gop.tag.test_value == np.float32(0)
     f = theano.function([], gop)
     assert f() == np.float32(0)
     assert f() == np.float32(1)
     for _ in range(2, 100):
         f()
     assert f() == np.float32(100)