測試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