属性错误:模块'tensorflow.python.estimator.estimator_lib'没有属性'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)

我的代码在上面。 然后它显示错误

"属性错误:模块'tensorflow.python.estimator.estimator_lib'没有属性'线性回归器'">

蟒蛇 3.5.2

可能是您使用的是较旧的 tensorflow 版本,因为tf.estimator.LinearRegressor包含在tensorflow=1.3.0中。

升级您的 TensorFlow 安装

pip install --upgrade tensorflow==1.3.0

最新更新