Ejemplo n.º 1
0
 def test_reduce_rows_1(self):
     data = [Row(x=float(x)) for x in range(5)]
     df = self.sql.createDataFrame(data)
     with tf.Graph().as_default() as g:
         # The placeholder that corresponds to column 'x'
         x_1 = tf.placeholder(tf.double, shape=[], name="x_1")
         x_2 = tf.placeholder(tf.double, shape=[], name="x_2")
         # The output that adds 3 to x
         x = tf.add(x_1, x_2, name='x')
         # The resulting number
         res = tfs.reduce_rows(x, df)
     assert res == sum([r.x for r in data])
Ejemplo n.º 2
0
 def test_reduce_rows_1(self):
     data = [Row(x=float(x)) for x in range(5)]
     df = self.sql.createDataFrame(data)
     with tf.Graph().as_default() as g:
         # The placeholder that corresponds to column 'x'
         x_1 = tf.placeholder(tf.double, shape=[], name="x_1")
         x_2 = tf.placeholder(tf.double, shape=[], name="x_2")
         # The output that adds 3 to x
         x = tf.add(x_1, x_2, name='x')
         # The resulting number
         res = tfs.reduce_rows(x, df)
     assert res == sum([r.x for r in data])