tf.placeholder

import numpy as np
import tensorflow as tf

p = tf.placeholder(dtype=tf.float32, shape=[1])
y = p

with tf.Session() as sess:
    d = np.random.rand(1)
    print(sess.run(y, feed_dict={p: d}))

占位符

tf.placeholder

不必指定初始值,可在运行时,通过 Session.runTensor.eval() 或者 Operation.run() 函数的 feed_dict 参数指定;

posted @   guqiangjs  阅读(274)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示