def test_append_tensorarray(self):
   l = tensor_array_ops.TensorArray(dtypes.int32, size=0, dynamic_size=True)
   l1 = data_structures.list_append(l, 1)
   l2 = data_structures.list_append(l1, 2)
   with self.test_session() as sess:
     self.assertAllEqual(sess.run(l1.stack()), [1])
     self.assertAllEqual(sess.run(l2.stack()), [1, 2])
예제 #2
0
 def test_append_tensorarray(self):
     l = tensor_array_ops.TensorArray(dtypes.int32,
                                      size=0,
                                      dynamic_size=True)
     l1 = data_structures.list_append(l, 1)
     l2 = data_structures.list_append(l1, 2)
     with self.test_session() as sess:
         self.assertAllEqual(sess.run(l1.stack()), [1])
         self.assertAllEqual(sess.run(l2.stack()), [1, 2])
예제 #3
0
    def test_append_tensor_list(self):
        l = data_structures.new_list()
        x = constant_op.constant([1, 2, 3])
        l = data_structures.list_append(l, x)

        t = list_ops.tensor_list_stack(l, element_dtype=x.dtype)
        with self.test_session() as sess:
            self.assertAllEqual(sess.run(t), [[1, 2, 3]])
  def test_append_tensor_list(self):
    l = data_structures.new_list()
    x = constant_op.constant([1, 2, 3])
    l = data_structures.list_append(l, x)

    t = list_ops.tensor_list_stack(l, element_dtype=x.dtype)
    with self.test_session() as sess:
      self.assertAllEqual(sess.run(t), [[1, 2, 3]])
예제 #5
0
 def test_append_python(self):
     l = []
     self.assertAllEqual(data_structures.list_append(l, 1), [1])
     self.assertAllEqual(data_structures.list_append(l, 2), [1, 2])
 def test_append_python(self):
   l = []
   self.assertAllEqual(data_structures.list_append(l, 1), [1])
   self.assertAllEqual(data_structures.list_append(l, 2), [1, 2])