作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在玩 tensorflow,我已经设法训练模式并提供服务,但是当我尝试运行客户端发送数据进行分类时,我得到了这个错误
grpc.framework.interfaces.face.face.AbortionError: AbortionError(code=StatusCode.INVALID_ARGUMENT, details="You must feed a value for placeholder tensor 'Placeholder_1' with dtype float
[[Node: Placeholder_1 = Placeholder_output_shapes=[[]], dtype=DT_FLOAT, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]]")
X = tf.placeholder(tf.float32,[None,n_dim])
y = tf.placeholder(tf.float32,[None,n_classes])
最佳答案
您需要实际设置您的值。占位符只是一个占位符,必须使用 feed_dict 设置为实际值。
像这样,请注意 sess.run 行:
import tensorflow as tf
X_vals = 1
X = tf.placeholder(tf.float32)
sess = tf.Session()
# sess.run(X) # This will throw the error you see
sess.run(X, feed_dict={X: X_vals}) # This works
关于python - TensorFlow 占位符错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42939426/
我是一名优秀的程序员,十分优秀!