在Windows 10上对TensorFlow r0.12(CPU)进行测试时,我发现打印出来的字符串contant最后总是带有一个“b”。python的打印是正常的。我想不出为什么来这里寻求帮助。代码如下:
>>>import tensorflow as tf
>>>hello = tf.constant('Hello, TensorFlow!')
>>>sess = tf.Session()
>>>print(sess.run(hello))
b'Hello, TensorFlow!'
Tags:
使用
sess.run(hello).decode()
,因为它是bytestring。decode
方法将返回字符串。你的打印声明必须看起来像
相关问题 更多 >
编程相关推荐