2016-12-16 62 views
2

我成功安裝了Tensorflow並運行了convolutional.py示例。 但是當我去運行示例Wide and Deep net tutorial,我收到以下錯誤Tensorflow無法運行廣泛而深入的網絡教程

% python wide_deep_tutorial.py                             
    Training data is downloaded to /tmp/tmpr3k3fwnc 
    Test data is downloaded to /tmp/tmpzxhrdh00 
    model directory = /tmp/tmpg_s1yutm 
    WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01. 
    WARNING:tensorflow:From /home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py:711 in fit.: calling BaseEstimator.fit (from tensorflow.contrib.learn.python.learn.estimators.estimator) with x is deprecated and will be removed after 2016-12-01. 
    Instructions for updating: 
    Estimator is decoupled from Scikit Learn interface by moving into 
    separate class SKCompat. Arguments x, y and batch_size are only 
    available in the SKCompat class, Estimator will only accept input_fn. 
    Example conversion: 
     est = Estimator(...) -> est = SKCompat(Estimator(...)) 
    WARNING:tensorflow:From /home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py:711 in fit.: calling BaseEstimator.fit (from tensorflow.contrib.learn.python.learn.estimators.estimator) with y is deprecated and will be removed after 2016-12-01. 
    Instructions for updating: 
    Estimator is decoupled from Scikit Learn interface by moving into 
    separate class SKCompat. Arguments x, y and batch_size are only 
    available in the SKCompat class, Estimator will only accept input_fn. 
    Example conversion: 
     est = Estimator(...) -> est = SKCompat(Estimator(...)) 
    WARNING:tensorflow:From /home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py:711 in fit.: calling BaseEstimator.fit (from tensorflow.contrib.learn.python.learn.estimators.estimator) with batch_size is deprecated and will be removed after 2016-12-01. 
    Instructions for updating: 
    Estimator is decoupled from Scikit Learn interface by moving into 
    separate class SKCompat. Arguments x, y and batch_size are only 
    available in the SKCompat class, Estimator will only accept input_fn. 
    Example conversion: 
     est = Estimator(...) -> est = SKCompat(Estimator(...)) 
    Traceback (most recent call last): 
     File "wide_deep_tutorial.py", line 208, in <module> 
     tf.app.run() 
     File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 43, in run 
     sys.exit(main(sys.argv[:1] + flags_passthrough)) 
     File "wide_deep_tutorial.py", line 204, in main 
     train_and_eval() 
     File "wide_deep_tutorial.py", line 197, in train_and_eval 
     m.fit(input_fn=lambda: input_fn(df_train), steps=FLAGS.train_steps) 
     File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 711, in fit 
     max_steps=max_steps) 
     File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 191, in new_func 
     return func(*args, **kwargs) 
     File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 355, in fit 
     max_steps=max_steps) 
     File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 690, in _train_model 
     features, labels = input_fn() 
     File "wide_deep_tutorial.py", line 197, in <lambda> 
     m.fit(input_fn=lambda: input_fn(df_train), steps=FLAGS.train_steps) 
     File "wide_deep_tutorial.py", line 159, in input_fn 
     for k in CATEGORICAL_COLUMNS} 
     File "wide_deep_tutorial.py", line 159, in <dictcomp> 
     for k in CATEGORICAL_COLUMNS} 
    TypeError: __init__() got an unexpected keyword argument 'dense_shape' 

similar問題中提出的大多數問題,有些人建議要卸載的protobuf和安裝tensorflow之後安裝它,但它並沒有在我的情況幫助,如果有人能幫助,我會很感激。

+1

嘗試用'形狀'代替'dense_shape'。我認爲它將在API的未來版本中被稱爲'dense_shape'。 – kempy

+0

它的工作,我認爲如果我使用dense_shape我應該從github直接簽出 – Eliethesaiyan

回答

5

TL; DR:確保運行的版本爲wide_n_deep_tutorial.py,與安裝的TensorFlow版本匹配。例如,如果您安裝了TensorFlow 0.12,則可以下載version from the r0.12 branch

文件wide_n_deep_tutorial.pyrecently changed在TensorFlow的主分支,以反映API中的變化(如kempy points out在他們的評論,tf.SparseTensor.shape正在成爲tf.SparseTensor.dense_shape下一個釋放)。

+0

你是對的,這是版本問題,我會留意下一個版本 – Eliethesaiyan