Type python to enter the Python environment:
python
Type the following commands
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, World!')
>>> sess = tf.Session()
>>> sess.run(hello)
b'Hello, World!'
>>>
Note that b'Hello, World!' represents byte literals.
If you want to print the message in a python file, use this command:
print(sess.run(hello))
Reference:
helloworld.py (GitHub:aymericdamien/TensorFlow-Examples)
What does the 'b' character do in front of a string literal? (Stack Overflow)
沒有留言:
張貼留言