用Tensorflow打印"hello world"

2017-11-27  本文已影响0人  secret_liang

在计算机科学领域大家都达成了一个默契,通常都是使用"HelloWorld" 作为演示程序,这里也不例外。我们的第一个程序就是用Tensorflow打印"hello world":

import tensorflow as tf
```python

```python
# Simple hello world using TensorFlow

# Create a Constant op
# The op is added as a node to the default graph.
#
# The value returned by the constructor represents the output
# of the Constant op.

hello = tf.constant('Hello, TensorFlow!')
# Start tf session
sess = tf.Session()
# Run graph
print sess.run(hello)
上一篇 下一篇

猜你喜欢

热点阅读