コード例 #1
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.cached_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.cached_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.cached_session() as sess:
            self.assertAllEqual(sess.run(t), [[1, 2, 3]])
コード例 #4
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.cached_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])
コード例 #6
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])