【发布时间】:2016-10-20 16:56:09
【问题描述】:
我有这个代码:
import tensorflow as tf
import numpy as np
data = np.random.randint(1000, size=10000)
x = tf.Variable(data, name='x')
y = tf.Variable(5*x*x-3*x+15, name='y')
model = tf.initialize_all_variables();
with tf.Session() as s:
s.run(model)
print (s.run(y))
我正在尝试执行与 tensorflow 变量相关的练习,但失败并出现以下错误:
尝试使用未初始化的值 x_20 [[节点:x_20/read = IdentityT=DT_INT64, _class=["loc:@x_20"], _device="/job:localhost/replica:0/task:0/cpu:0"]]
我也尝试使用常量初始化 x,但仍然失败。我在这里错过了什么?
【问题讨论】:
标签: tensorflow