AttributeError:模块“ tensorflow.python.framework.tensor_shape”没有属性“ scalar”

库纳尔·索旺(Kunal Sawant)

我正在尝试训练DNNClassifier,但是当我尝试训练模型时,我一直遇到称为

AttributeError:模块“ tensorflow.python.framework.tensor_shape”没有属性“ scalar”

import tensorflow as tf
from sklearn.datasets import fetch_openml
mnist = fetch_openml('mnist_784')



feature_columns = [tf.feature_column.numeric_column("x", shape=[784])]

feature_columns

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(mnist['data'] , mnist['target'])

classifier = tf.estimator.DNNClassifier(hidden_units=[300, 100], n_classes=10,
                                             feature_columns=feature_columns)


def input_train_fn(X,y):
    features = {'x':tf.convert_to_tensor(X)}
    return features, y.reshape((-1,1)).astype(int)


classifier.train(input_fn=lambda : input_train_fn(X_train, y_train), steps=100000)

最后一行引发以下错误:-

AttributeError:模块“ tensorflow.python.framework.tensor_shape”没有属性“ scalar”

李秀贤

升级tensorflow和tensorflow-estimator可能会有所帮助。

我在Github tf-estimator存储库(https://github.com/tensorflow/estimator/commit/561b3f95d4f9041cb7a2fbbfdc94efee16413725#diff-a815f16c6f90bfe736d98b8c99a7c2fcL337)中找到了此提交

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

AttributeError:模块“ tensorflow.python.framework.op_def_registry”没有属性“ get_registered_ops”

来自分类Dev

TensorFlow:AttributeError:'Tensor'对象没有属性'shape'

来自分类Dev

AttributeError: 模块 'tensorflow.python.ops.linalg.linear_operator_util' 没有属性 'matmul_with_broadcast'

来自分类Dev

Python AttributeError:“模块”没有属性“ currentanimation”

来自分类Dev

错误消息AttributeError:模块'tensorflow'没有属性'VERSION'

来自分类Dev

AttributeError:模块“ tensorflow”没有属性“ enable_eager_execution”

来自分类Dev

AttributeError:模块“ tensorflow”没有属性“ app”:错误

来自分类Dev

AttributeError:模块“ tensorflow”没有属性“ random_shuffle”

来自分类Dev

AttributeError:模块“ tensorflow”没有属性“ get_variable”

来自分类Dev

AttributeError:模块“ tensorflow”没有属性“ name_scope”

来自分类Dev

AttributeError:模块“ tensorflow_datasets.text”没有属性“ YelpPolarityReviews”

来自分类Dev

AttributeError:模块“ tensorflow”没有属性“ string_join”

来自分类Dev

Tensorflow AttributeError:'模块'对象没有属性'不推荐使用'

来自分类Dev

AttributeError:“ Tensor”对象在Tensorflow 2.1中没有属性“ numpy”

来自分类Dev

AttributeError:模块“ tensorflow.compat”没有属性“ v1” Tensorflow v:1.10.0

来自分类Dev

Tensorflow=1.12.0 AttributeError: 模块“tensorflow”没有属性“feature_column”

来自分类Dev

AttributeError:“模块”对象没有属性“调用”:Python

来自分类Dev

python-opencv AttributeError:“模块”对象没有属性“ createBackgroundSubtractorGMG”

来自分类Dev

python-AttributeError:“模块”对象没有属性“锁”

来自分类Dev

Python AttributeError:“模块”对象没有属性“连接”

来自分类Dev

Python :: AttributeError:“模块”对象没有属性“接口”

来自分类Dev

Python AttributeError:模块“ runAnalytics”没有属性“ run”

来自分类Dev

Python 3 AttributeError:模块'sys'没有属性'argv'

来自分类Dev

Python AttributeError:“模块”对象没有属性“ atoi”

来自分类Dev

python-opencv AttributeError:“模块”对象没有属性“ createBackgroundSubtractorGMG”

来自分类Dev

Python AttributeError:“模块”对象没有属性“套房”

来自分类Dev

Python:AttributeError:“模块”对象没有属性“ randrange”

来自分类Dev

AttributeError:“模块”对象没有属性“ urlopen”(Python 2.7)

来自分类Dev

Python AttributeError:“模块”对象没有属性“获取”

Related 相关文章

  1. 1

    AttributeError:模块“ tensorflow.python.framework.op_def_registry”没有属性“ get_registered_ops”

  2. 2

    TensorFlow:AttributeError:'Tensor'对象没有属性'shape'

  3. 3

    AttributeError: 模块 'tensorflow.python.ops.linalg.linear_operator_util' 没有属性 'matmul_with_broadcast'

  4. 4

    Python AttributeError:“模块”没有属性“ currentanimation”

  5. 5

    错误消息AttributeError:模块'tensorflow'没有属性'VERSION'

  6. 6

    AttributeError:模块“ tensorflow”没有属性“ enable_eager_execution”

  7. 7

    AttributeError:模块“ tensorflow”没有属性“ app”:错误

  8. 8

    AttributeError:模块“ tensorflow”没有属性“ random_shuffle”

  9. 9

    AttributeError:模块“ tensorflow”没有属性“ get_variable”

  10. 10

    AttributeError:模块“ tensorflow”没有属性“ name_scope”

  11. 11

    AttributeError:模块“ tensorflow_datasets.text”没有属性“ YelpPolarityReviews”

  12. 12

    AttributeError:模块“ tensorflow”没有属性“ string_join”

  13. 13

    Tensorflow AttributeError:'模块'对象没有属性'不推荐使用'

  14. 14

    AttributeError:“ Tensor”对象在Tensorflow 2.1中没有属性“ numpy”

  15. 15

    AttributeError:模块“ tensorflow.compat”没有属性“ v1” Tensorflow v:1.10.0

  16. 16

    Tensorflow=1.12.0 AttributeError: 模块“tensorflow”没有属性“feature_column”

  17. 17

    AttributeError:“模块”对象没有属性“调用”:Python

  18. 18

    python-opencv AttributeError:“模块”对象没有属性“ createBackgroundSubtractorGMG”

  19. 19

    python-AttributeError:“模块”对象没有属性“锁”

  20. 20

    Python AttributeError:“模块”对象没有属性“连接”

  21. 21

    Python :: AttributeError:“模块”对象没有属性“接口”

  22. 22

    Python AttributeError:模块“ runAnalytics”没有属性“ run”

  23. 23

    Python 3 AttributeError:模块'sys'没有属性'argv'

  24. 24

    Python AttributeError:“模块”对象没有属性“ atoi”

  25. 25

    python-opencv AttributeError:“模块”对象没有属性“ createBackgroundSubtractorGMG”

  26. 26

    Python AttributeError:“模块”对象没有属性“套房”

  27. 27

    Python:AttributeError:“模块”对象没有属性“ randrange”

  28. 28

    AttributeError:“模块”对象没有属性“ urlopen”(Python 2.7)

  29. 29

    Python AttributeError:“模块”对象没有属性“获取”

热门标签

归档