关于tensorflow.placeholder()理解

对于这样一条语句
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

猜你喜欢

转载自blog.csdn.net/LuffysMan/article/details/86518650