TensorFlow (1) Up and Running with TensorFlow
1. Installing TensorFlow:
先來簡單安裝一般版的 TensorFlow(PS. 我家只有一張破爛顯卡 QQ):
$ pip3 install tensorflow
2. TensorFlow Helloworld:
馬上來寫點程式。
import tensorflow as tf a = tf.constant(1) b = tf.constant(2) c = a + b with tf.Session() as sess: res = sess.run(c) print(res)
with 會幫你呼叫 close() 所以實際上類似下面的程式。
sess = tf.Session() res = sess.run(c) sess.close()
Reference
[1] Tom Hope, Yehezkel S. Resheff, and Itay Lieder, Learning TensorFlow A Guide to Building Deep Learning Systems , O'Reilly Media (2017)
留言
張貼留言