【问题标题】:module 'tensorflow_estimator.python.estimator.api._v2.estimator' has no attribute 'inputs'模块“tensorflow_estimator.python.estimator.api._v2.estimator”没有属性“输入”
【发布时间】:2019-07-09 17:09:29
【问题描述】:

我正在使用 tensorflow 版本 2.0.0-beta1。打电话时

tf.estimator.inputs.pandas_input_fn

它给了我一个错误。

module 'tensorflow_estimator.python.estimator.api._v2.estimator' has no attribute 'inputs'

为了确定我尝试过的问题

tf.estimator.inputs

这给了我以下错误

module 'tensorflow_estimator.python.estimator.api._v2.estimator' has no attribute 'inputs'

我尝试在本地机器和 Google Colab 上重新安装 tensorflow,但这似乎不起作用。与之前版本的 tensorflow 相比,新版本的 tensorflow 中此功能是否有任何变化,即(tf 版本 1.x)

【问题讨论】:

标签: python tensorflow tensorflow2.0


【解决方案1】:

Tensorflow V1 中,在从 Pandas DataFrames 读取tf.estimator 的输入时,我们使用了以下命令:tf.estimator.inputs.pandas_input_fn。但是现在由于 API 的变化,我们将不得不用这个命令替换那个命令:tf.compat.v1.estimator.inputs.pandas_input_fn。在这里,我们从 Tensorflow 的 Version1 到 Version2 获取相同的命令。

【讨论】:

    【解决方案2】:

    tf.compat.v1.estimator.inputs.pandas_input_fn

    【讨论】:

    • 确保解释你的代码。为什么这有效,它有什么不同,等等。
    猜你喜欢
    • 1970-01-01
    • 2022-11-28
    • 2019-09-09
    • 2021-02-13
    • 2020-06-25
    • 2022-07-06
    • 2022-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多