AttributeError:モジュール 'tensorflow.python.framework.tensor_shape'に属性 'scalar'がありません

クナルサワント

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をアップグレードすると役立つ場合があります。

このコミットはGithubtf-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

AttributeError:モジュール 'tensorflow.python.training.checkpointable'に属性 'CheckpointableBase'がありません

分類Dev

Tensorflow: 'モジュール'オブジェクトには属性がありません 'scalar_summary'

分類Dev

AttributeError:モジュール 'tensorflow.python.estimator.estimator_lib'には属性 'LinearRegressor'がありません

分類Dev

AttributeError:モジュール 'tensorflow.python.training.training'には属性 'SummaryWriter'がありません

分類Dev

Tensorflowモジュールインポートエラー:AttributeError:モジュール 'tensorflow.python.ops.nn'には属性 'rnn_cell'がありません

分類Dev

Tensorflow 2.0-AttributeError:モジュール 'tensorflow'に属性 'Session'がありません

分類Dev

AttributeError:モジュール 'tensorflow'に属性 'app'がありません:エラー

分類Dev

AttributeError:モジュール 'tensorflow'にKerasの属性 'name_scope'がありません

分類Dev

AttributeError:モジュール 'tensorflow'に属性 'reset_default_graph'がありません

分類Dev

AttributeError:モジュール 'tensorflow.io'に属性 'experimental'がありません

分類Dev

AttributeError:モジュール 'tensorflow.contrib.learn'に属性 'TensorFlowDNNClassifier'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'unpack'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'float32'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'Session'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'gfile'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'get_default_graph'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'enable_eager_execution'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'get_variable'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'random_shuffle'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'name_scope'がありません

分類Dev

AttributeError:モジュール 'tensorflow'には属性 'string_join'がありません

分類Dev

AttributeError:モジュール 'tensorflow_datasets.text'に属性 'YelpPolarityReviews'がありません

分類Dev

Python3.6 AttributeError:モジュール 'asyncio'に属性 'run'がありません

分類Dev

python-chess-AttributeError:モジュール 'chess'には属性 'pgn'がありません

分類Dev

Python 3.6-AttributeError:モジュール 'tkinter'には属性 'filedialog'がありません

分類Dev

Python:AttributeErrorモジュールxには属性yがありません

分類Dev

Python Tornado AttributeError:モジュール 'test'に属性 '__path__'がありません

分類Dev

Python 3 AttributeError:モジュール 'sys'に属性 'argv'がありません

Related 関連記事

  1. 1

    AttributeError:モジュール 'tensorflow.python.framework.op_def_registry'には属性 'get_registered_ops'がありません

  2. 2

    AttributeError:モジュール 'tensorflow.python.training.checkpointable'に属性 'CheckpointableBase'がありません

  3. 3

    Tensorflow: 'モジュール'オブジェクトには属性がありません 'scalar_summary'

  4. 4

    AttributeError:モジュール 'tensorflow.python.estimator.estimator_lib'には属性 'LinearRegressor'がありません

  5. 5

    AttributeError:モジュール 'tensorflow.python.training.training'には属性 'SummaryWriter'がありません

  6. 6

    Tensorflowモジュールインポートエラー:AttributeError:モジュール 'tensorflow.python.ops.nn'には属性 'rnn_cell'がありません

  7. 7

    Tensorflow 2.0-AttributeError:モジュール 'tensorflow'に属性 'Session'がありません

  8. 8

    AttributeError:モジュール 'tensorflow'に属性 'app'がありません:エラー

  9. 9

    AttributeError:モジュール 'tensorflow'にKerasの属性 'name_scope'がありません

  10. 10

    AttributeError:モジュール 'tensorflow'に属性 'reset_default_graph'がありません

  11. 11

    AttributeError:モジュール 'tensorflow.io'に属性 'experimental'がありません

  12. 12

    AttributeError:モジュール 'tensorflow.contrib.learn'に属性 'TensorFlowDNNClassifier'がありません

  13. 13

    AttributeError:モジュール 'tensorflow'には属性 'unpack'がありません

  14. 14

    AttributeError:モジュール 'tensorflow'には属性 'float32'がありません

  15. 15

    AttributeError:モジュール 'tensorflow'には属性 'Session'がありません

  16. 16

    AttributeError:モジュール 'tensorflow'には属性 'gfile'がありません

  17. 17

    AttributeError:モジュール 'tensorflow'には属性 'get_default_graph'がありません

  18. 18

    AttributeError:モジュール 'tensorflow'には属性 'enable_eager_execution'がありません

  19. 19

    AttributeError:モジュール 'tensorflow'には属性 'get_variable'がありません

  20. 20

    AttributeError:モジュール 'tensorflow'には属性 'random_shuffle'がありません

  21. 21

    AttributeError:モジュール 'tensorflow'には属性 'name_scope'がありません

  22. 22

    AttributeError:モジュール 'tensorflow'には属性 'string_join'がありません

  23. 23

    AttributeError:モジュール 'tensorflow_datasets.text'に属性 'YelpPolarityReviews'がありません

  24. 24

    Python3.6 AttributeError:モジュール 'asyncio'に属性 'run'がありません

  25. 25

    python-chess-AttributeError:モジュール 'chess'には属性 'pgn'がありません

  26. 26

    Python 3.6-AttributeError:モジュール 'tkinter'には属性 'filedialog'がありません

  27. 27

    Python:AttributeErrorモジュールxには属性yがありません

  28. 28

    Python Tornado AttributeError:モジュール 'test'に属性 '__path__'がありません

  29. 29

    Python 3 AttributeError:モジュール 'sys'に属性 'argv'がありません

ホットタグ

アーカイブ