예제 #1
0
 def test_scan_with_struct_elems(self):
   elems = (np.arange(5).astype(np.int32),
            np.arange(10).astype(np.int32).reshape(5, 2))
   init = (np.int32([7, 8]), np.int32([9, 1]))
   self.assertAllEqual(
       self.evaluate(tf.scan(
           lambda x, y: (x[0] + y[0], x[1] - y[1]), elems, initializer=init)),
       nptf.scan(
           lambda x, y: (x[0] + y[0], x[1] - y[1]), elems, initializer=init))
예제 #2
0
 def test_scan_with_struct(self):
     elems = np.arange(5).astype(np.int32)
     self.assertAllEqual(
         self.evaluate(
             tf.scan(lambda x, y: (x[0] + y, x[1] - y),
                     elems,
                     initializer=(7, 3))),
         nptf.scan(lambda x, y: (x[0] + y, x[1] - y),
                   elems,
                   initializer=(7, 3)))
예제 #3
0
 def test_scan_with_initializer(self):
     elems = np.arange(5).astype(np.int32)
     self.assertAllEqual(
         self.evaluate(tf.scan(lambda x, y: x + y, elems, initializer=7)),
         nptf.scan(lambda x, y: x + y, elems, initializer=7))