测试TensorFlow是否安装成功


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))

结果会输出,如下图所示


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM