【发布时间】:2017-03-17 12:18:56
【问题描述】:
在制作 DNN 回归器并通过以下方式预测值时
print(list(estimator.predict({"p": np.array([[0.,0.],[1.,0.],[0.,1.],[1.,1.]])})))
这是控制台的输出:
WARNING:tensorflow:From "...\tensorflow\contrib\learn\python\learn\estimators\dnn.py":692: calling BaseEstimator.predict (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(...))
所以我进入dnn.py 的第 692 行,这就是我发现的
preds = super(DNNRegressor, self).predict(
x=x,
input_fn=input_fn,
batch_size=batch_size,
outputs=[key],
as_iterable=as_iterable)
所以遵循错误的建议,并假设 super(DNNRegressor, self) 是 Estimator 我刚刚做了
preds = estimator.SKCompat(super(DNNRegressor, self)).predict(...)
但这样做我得到了
TypeError: predict() got an unexpected keyword argument 'input_fn'
这看起来不是张量流错误。
问题是我不知道如何摆脱警告(不是错误)。
【问题讨论】:
标签: python-3.x tensorflow