AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'LinearRegressor'
AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'LinearRegressor'
import tensorflow as tf
import numpy as np
feature_columns = [tf.feature_column.numeric_column("x", shape=[1])]
estimator = tf.estimator.LinearRegressor(feature_columns=feature_columns)
我的代码在上面。
然后显示错误
"AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'LinearRegressor'"
Python 3.5.2
可能是您使用的是较旧的 tensorflow 版本,因为 tf.estimator.LinearRegressor
包含在 tensorflow=1.3.0
中。
升级您的 tensorflow 安装
pip install --upgrade tensorflow==1.3.0
import tensorflow as tf
import numpy as np
feature_columns = [tf.feature_column.numeric_column("x", shape=[1])]
estimator = tf.estimator.LinearRegressor(feature_columns=feature_columns)
我的代码在上面。 然后显示错误
"AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'LinearRegressor'"
Python 3.5.2
可能是您使用的是较旧的 tensorflow 版本,因为 tf.estimator.LinearRegressor
包含在 tensorflow=1.3.0
中。
升级您的 tensorflow 安装
pip install --upgrade tensorflow==1.3.0