【问题标题】:Undeprecating tensorflow不弃用的张量流
【发布时间】: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


    【解决方案1】:

    Github tree 的这一部分正在积极开发中。我希望一旦将 Estimator 类移入 tf.core(这是 r1.1 版的计划),此警告消息就会消失。我发现 Martin Wicke 的 2017 年 TensorFlow 开发峰会video 对高级 TensorFlow 的未来计划提供了非常丰富的信息。

    【讨论】:

      猜你喜欢
      • 2017-12-01
      • 2017-11-05
      • 1970-01-01
      • 1970-01-01
      • 2018-05-21
      • 2019-08-02
      • 1970-01-01
      • 2018-12-13
      • 1970-01-01
      相关资源
      最近更新 更多