tensorflow learn - 初始化变量

时间:2016-07-21 08:36:49

标签: tensorflow skflow

我开始使用“tensforflow learn”(以前称为skflow)时遇到问题。

我的问题?

我甚至无法运行DNN的最简单示例

以下示例抛出错误

**RuntimeError: Init operations did not make model ready.  Init op: 
init,  init fn: None, error: Variables not initialized: global_step, 
linear/_weight..*

在jupyter笔记本中,内核突然结束了?

我错过了什么或者它是一个错误?

from tensorflow.contrib import learn
from sklearn import datasets, metrics, cross_validation
iris = datasets.load_iris()
classifier = learn.DNNClassifier(hidden_units=[10,20,10],n_classes = 3)
classifier.fit(iris.data, iris.target, steps=200, batch_size=32)

P.S:我有9版本

import tensorflow as tf 
tf.__version__

P.S: 可以请有足够声誉的人创建标签 tensorflow-learn 我发现谷歌将skflow重命名为tensorflow学习是不幸的。存在与tflearn库混淆的风险(除非这是有意的。)

谢谢

更新1

重新启动计算机后,我无法复制错误。 对此感到尴尬

更新2

我想我知道为什么。 当您创建第二个jupyter笔记本会话时(或者就cli上的第二个ipython会话而言),会发生错误。

我发布了一个更长的错误字符串,以防它帮助其他人

 RuntimeError: Init operations did not make model ready.  Init op: init,   init fn: None, error: Variables not initialized: global_step, hiddenlayer_0/weights, hiddenlayer_0/bias, hiddenlayer_1/weights, hiddenlayer_1/bias, hiddenlayer_2/weights, hiddenlayer_2/bias, dnn_logit/bias, centered_bias_weight, centered_bias_weight/Adagrad, hiddenlayer_0/bias/Adagrad, hiddenlayer_1/weights/Adagrad, hiddenlayer_1/bias/Adagrad, hiddenlayer_2/bias/Adagrad, dnn_logit/weights/Adagrad, dnn_logit/bias/Adagrad, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step, global_step,

1 个答案:

答案 0 :(得分:2)

当您尝试同时运行2个tensorflow应用程序时会发生这种情况。

第一个应用程序将占用所有GPU的内存。