コード例 #1
0
 def testPrintTensorArrayPassthrough(self):
   a = tensor_array_ops.TensorArray(
       size=2, dtype=dtypes.int32, clear_after_read=False)
   a = a.write(1, 1)
   a = a.write(0, 0)
   a = prettyprint_ops.print_op(a)
   with self.test_session():
     self.assertAllEqual(a.stack().eval(), constant_op.constant([0, 1]).eval())
コード例 #2
0
 def testPrintSparseTensorPassthrough(self):
   a = sparse_tensor.SparseTensor(
       indices=[[0, 0], [1, 2]], values=[1, 2], dense_shape=[3, 4])
   b = sparse_tensor.SparseTensor(
       indices=[[0, 0], [1, 2]], values=[1, 2], dense_shape=[3, 4])
   a = prettyprint_ops.print_op(a)
   with self.test_session():
     self.assertAllEqual(
         sparse_ops.sparse_tensor_to_dense(a).eval(),
         sparse_ops.sparse_tensor_to_dense(b).eval())
コード例 #3
0
 def testPrintVariable(self):
   a = variables.Variable(1.0)
   a = prettyprint_ops.print_op(a)
   with self.test_session():
     variables.global_variables_initializer().run()
     a.eval()
コード例 #4
0
 def testPrintTensorPassthrough(self):
   a = constant_op.constant([1])
   a = prettyprint_ops.print_op(a)
   with self.test_session():
     self.assertEqual(a.eval(), constant_op.constant([1]).eval())