質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

0回答

2795閲覧

Tensorflowの実行にエラーが表示される。

退会済みユーザー

退会済みユーザー

総合スコア0

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2017/05/15 03:19

編集2022/01/12 10:55

tensorflowのfully_connected_feed.pyを実行しようとすると、エラーがでます。

2017年5月15日現在で
$ git clone https://github.com/tensorflow/tensorflow
を実行したtensorflowファイルの中で
$ python fully_connected_feed.py
を実行すると以下のようなエラー文が出ます。

Traceback (most recent call last): File "tensorflow/examples/tutorials/mnist/fully_connected_feed.py", line 277, in <module> tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) TypeError: run() got an unexpected keyword argument 'main'

このエラー文で検索してみると、「前のバージョンを使ってみると良いよ」とあったので、

r0.8でブランチ切っているものをインストールしてみました。
$ git clone -b r0.8 --recurse-submodules https://github.com/tensorflow/tensorflow
これで同じように
$ python fully_connected_feed.py
を実行してみると、次は以下のようなエラー文が表示されました。

Extracting data/train-images-idx3-ubyte.gz Extracting data/train-labels-idx1-ubyte.gz Extracting data/t10k-images-idx3-ubyte.gz Extracting data/t10k-labels-idx1-ubyte.gz I tensorflow/core/common_runtime/local_device.cc:40] Local device intra op parallelism threads: 8 I tensorflow/core/common_runtime/direct_session.cc:58] Direct session inter op parallelism threads: 8 Traceback (most recent call last): File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 517, in init copy.MergeFrom(new_val) File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 1208, in MergeFrom "expected %s got %s." % (cls.__name__, type(msg).__name__)) TypeError: Parameter to MergeFrom() must be instance of same class: expected GraphDef got Graph. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "tensorflow/examples/tutorials/mnist/fully_connected_feed.py", line 226, in <module> tf.app.run() File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run sys.exit(main(sys.argv)) File "tensorflow/examples/tutorials/mnist/fully_connected_feed.py", line 222, in main run_training() File "tensorflow/examples/tutorials/mnist/fully_connected_feed.py", line 164, in run_training summary_writer = tf.train.SummaryWriter(FLAGS.train_dir, sess.graph) File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/tensorflow/python/training/summary_io.py", line 103, in __init__ self.add_graph(graph_def) File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/tensorflow/python/training/summary_io.py", line 151, in add_graph event = event_pb2.Event(wall_time=time.time(), graph_def=graph_def) File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 519, in init _ReraiseTypeErrorWithFieldName(message_descriptor.name, field_name) File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 450, in _ReraiseTypeErrorWithFieldName six.reraise(type(exc), exc, sys.exc_info()[2]) File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/six.py", line 685, in reraise raise value.with_traceback(tb) File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 517, in init copy.MergeFrom(new_val) File "/Users/maru/.pyenv/versions/py350tensorflow/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 1208, in MergeFrom "expected %s got %s." % (cls.__name__, type(msg).__name__)) TypeError: Parameter to MergeFrom() must be instance of same class: expected GraphDef got Graph. for field Event.graph_def

最後の行のエラー文で検索してみると、次は「最新バージョンをインストールすることを強くおすすめします」とありました。

どこに問題があるのでしょうか。
ご存じの方がいらっしゃればよろしくお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問