Shi*_*ata 3 python-3.x keras tensorflow
我尝试在我的计算机上使用 Keras,但不断收到错误消息“AttributeError:模块‘tensorflow.python.keras.backend’没有属性‘get_graph’”。
堆栈跟踪是:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-dd13cebc6f04> in <module>
----> 1 import acgan
~/Documents/GitHub/Keras-GAN/acgan/acgan.py in <module>
1 from __future__ import print_function, division
2
----> 3 from keras.datasets import mnist
4 from keras.layers import Input, Dense, Reshape, Flatten, Dropout, multiply
5 from keras.layers import BatchNormalization, Activation, Embedding, ZeroPadding2D
/anaconda3/lib/python3.6/site-packages/keras/__init__.py in <module>
1 from __future__ import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications
/anaconda3/lib/python3.6/site-packages/keras/utils/__init__.py in <module>
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7 from . import losses_utils
8 from . import metrics_utils
/anaconda3/lib/python3.6/site-packages/keras/utils/conv_utils.py in <module>
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11
/anaconda3/lib/python3.6/site-packages/keras/backend/__init__.py in <module>
----> 1 from .load_backend import epsilon
2 from .load_backend import set_epsilon
3 from .load_backend import floatx
4 from .load_backend import set_floatx
5 from .load_backend import cast_to_floatx
/anaconda3/lib/python3.6/site-packages/keras/backend/load_backend.py in <module>
88 elif _BACKEND == 'tensorflow':
89 sys.stderr.write('Using TensorFlow backend.\n')
---> 90 from .tensorflow_backend import *
91 else:
92 # Try and load external backend.
/anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in <module>
52
53 # Private TF Keras utils
---> 54 get_graph = tf_keras_backend.get_graph
55 # learning_phase_scope = tf_keras_backend.learning_phase_scope #
TODO
56 name_scope = tf.name_scope
AttributeError: module 'tensorflow.python.keras.backend' has no attribute 'get_graph'
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索了这个问题并发现了这个
这告诉我它与张量流版本相关,但不告诉我要使用哪个版本。我在 MacOS 上使用 Python3。
感谢您的帮助。
我无法重现您在 Keras 2.3.0 和 tensorflow 2.0.0rc1 中观察到的错误。虽然我能够开始 acgan 的训练,但在一次迭代后我得到了一个不同的错误:Resource localhost/_AnonymousVar84/N10tensorflow3VarE does not exist。
我可以使用以下版本成功运行该示例:
keras为tensorflow.keras导入中的。| 归档时间: |
|
| 查看次数: |
9010 次 |
| 最近记录: |