コード例 #1
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]])
コード例 #2
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]])
コード例 #3
0
 def test_new_list_tensor(self):
     l = data_structures.new_list([3, 4, 5])
     self.assertAllEqual(l, [3, 4, 5])
コード例 #4
0
 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))
コード例 #5
0
 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])
コード例 #6
0
 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])
コード例 #7
0
 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))
コード例 #8
0
 def test_new_list_tensor(self):
   l = data_structures.new_list([3, 4, 5])
   self.assertAllEqual(l, [3, 4, 5])