對於這樣一條語句
x = tf.placeholder("float",shape=(1,2))
我的理解是在內存中開辟了一塊內存,大小為1x2的float數組;
然后再程序的運行過程中,可不斷用以下語句來“喂”它,達到隨時改變數據集的目的
feed_dict={x:[[1,2]]}
測試代碼
#coding=utf-8
import tensorflow as tf
x = tf.placeholder("float",shape=(1,2))
sess = tf.Session()
sess.run(tf.global_variables_initializer())
a = x
y = sess.run(a, feed_dict={x:[[1,2]]})
print(y)
sess.close