【发布时间】:2023-03-13 00:20:02
【问题描述】:
现在,我有一些如下代码:
import tensorflow as tf
x = tf.placeholder(tf.float32, [1, 3])
y = x * 2
with tf.Session() as sess:
result = sess.run(y, feed_dict={x: [2, 4, 6]})
print(result)
我想为函数提供值。
下面是一个明显的错误。 我该怎么做呢?
import tensorflow as tf
def place_func():
x = tf.placeholder(tf.float32, [1, 3])
y = x * 2
with tf.Session() as sess:
result = sess.run(y, feed_dict={x: [2, 4, 6]})
print(result)
【问题讨论】:
标签: python tensorflow placeholder