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_new_list_tensor(self): l = data_structures.new_list([3, 4, 5]) self.assertAllEqual(l, [3, 4, 5])
def test_new_list_empty(self): l = data_structures.new_list() # Can't evaluate an empty list. # TODO(mdan): sess.run should allow tf.variant maybe? self.assertTrue(isinstance(l, ops.Tensor))
def test_new_list_tensor(self): l = data_structures.new_list([3, 4, 5]) t = list_ops.tensor_list_stack(l, element_dtype=dtypes.int32) with self.test_session() as sess: self.assertAllEqual(sess.run(t), [3, 4, 5])