运行TensorFlow wide_n_deep教程时出错

时间:2016-12-08 02:20:17

标签: tensorflow python-3.5

我遇到了错误:

  

AttributeError:'NoneType'对象没有属性'bucketize'

完整错误如下:

Traceback (most recent call last):
  File "wide_n_deep_tutorial_1.py", line 214, in <module>
    train_and_eval()
  File "wide_n_deep_tutorial_1.py", line 203, in train_and_eval
    m.fit(input_fn=lambda: input_fn(df_train), steps=FLAGS.train_steps)
  File "C:\Python35\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\dnn_linear_combined.py", line 711, in fit
    max_steps=max_steps)
  File "C:\Python35\lib\site-packages\tensorflow\python\util\deprecation.py", line 191, in new_func
    return func(*args, **kwargs)
  File "C:\Python35\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 355, in fit
    max_steps=max_steps)
  File "C:\Python35\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 699, in _train_model
    train_ops = self._get_train_ops(features, labels)
  File "C:\Python35\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 1052, in _get_train_ops
    return self._call_model_fn(features, labels, model_fn_lib.ModeKeys.TRAIN)
  File "C:\Python35\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 1019, in _call_model_fn
    params=self.params)
  File "C:\Python35\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\dnn_linear_combined.py", line 504, in _dnn_linear_combined_model_fn
    scope=scope)
  File "C:\Python35\lib\site-packages\tensorflow\contrib\layers\python\layers\feature_column_ops.py", line 526, in weighted_sum_from_feature_columns
    transformed_tensor = transformer.transform(column)
  File "C:\Python35\lib\site-packages\tensorflow\contrib\layers\python\layers\feature_column_ops.py", line 869, in transform
    feature_column.insert_transformed_feature(self._columns_to_tensors)
  File "C:\Python35\lib\site-packages\tensorflow\contrib\layers\python\layers\feature_column.py", line 1489, in insert_transformed_feature
    name="bucketize")
  File "C:\Python35\lib\site-packages\tensorflow\contrib\layers\python\ops\bucketization_op.py", line 48, in bucketize
    return _bucketization_op.bucketize(input_tensor, boundaries, name=name)
AttributeError: 'NoneType' object has no attribute 'bucketize'

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,似乎在Windows上,我们只得到了无,sourcecode, 尝试在linux上运行此代码,或尝试删除bucketization和列交叉,例如。换行:

flags.DEFINE_string("model_type","wide_n_deep","valid model types:{'wide','deep', 'wide_n_deep'")

flags.DEFINE_string("model_type","deep","valid model types:{'wide','deep', 'wide_n_deep'")

请按照此问题进行更新:issue