TensorFlow學習筆記1:Hello TensorFlow!

根據 https://github.com/aymericdamien/TensorFlow-Examples 學習TensorFlow

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
其中第二行定義了常量hello,在TensorFlow中,tf.constant(value, dtype=None, shape=None, name='Const'),其中value表示值,dtype表示類型,shape可用於返回矩陣,向量等,name爲結果的名字,tf.constant 返回一個常量張量。

第三行開始了一個session,第四行輸出hello。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章