1、测试TensorFlow是否安装成功
python
import tensorflow as tf
hello=tf.constant(\'hello,world\')
sess=tf.Session()
print(sess.run(hello))
结果会输出,如下图所示
2、TensorFlow的入门代码:简单的加法运算
import tensorflow as tf
x=tf.constant(1)
y=tf.constant(2)
z=x+y
sess=tf.Session()
print(sess.run(z))
结果会输出,如下图所示