Face-generation-GAN icon indicating copy to clipboard operation
Face-generation-GAN copied to clipboard

module 'tensorflow' has no attribute 'get_default_graph'

Open MrRaymondLee opened this issue 3 years ago • 0 comments

I'm getting a new error now. I'm using tf 2.1.0. Keras installs:

Keras                2.1.0
Keras-Applications   1.0.8
Keras-Preprocessing  1.1.2
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-27e9790611ce> in <module>
     64     return discriminator
     65 
---> 66 generator = create_generator()
     67 discriminator = create_discriminator()
     68 discriminator.trainable = False

<ipython-input-2-27e9790611ce> in create_generator()
      1 def create_generator():
----> 2     gen_input = Input(shape=(LATENT_DIM, ))
      3 
      4     x = Dense(128 * 16 * 16)(gen_input)
      5     x = LeakyReLU()(x)

g:\jupyterlab_py37\venv\lib\site-packages\keras\engine\topology.py in Input(shape, batch_shape, name, dtype, sparse, tensor)
   1437                              name=name, dtype=dtype,
   1438                              sparse=sparse,
-> 1439                              input_tensor=tensor)
   1440     # Return tensor including _keras_shape and _keras_history.
   1441     # Note that in this case train_output and test_output are the same pointer.

g:\jupyterlab_py37\venv\lib\site-packages\keras\legacy\interfaces.py in wrapper(*args, **kwargs)
     85                 warnings.warn('Update your `' + object_name +
     86                               '` call to the Keras 2 API: ' + signature, stacklevel=2)
---> 87             return func(*args, **kwargs)
     88         wrapper._original_function = func
     89         return wrapper

g:\jupyterlab_py37\venv\lib\site-packages\keras\engine\topology.py in __init__(self, input_shape, batch_size, batch_input_shape, dtype, input_tensor, sparse, name)
   1299         if not name:
   1300             prefix = 'input'
-> 1301             name = prefix + '_' + str(K.get_uid(prefix))
   1302         super(InputLayer, self).__init__(dtype=dtype, name=name)
   1303 

g:\jupyterlab_py37\venv\lib\site-packages\keras\backend\tensorflow_backend.py in get_uid(prefix)
     61     """
     62     global _GRAPH_UID_DICTS
---> 63     graph = tf.get_default_graph()
     64     if graph not in _GRAPH_UID_DICTS:
     65         _GRAPH_UID_DICTS[graph] = defaultdict(int)

AttributeError: module 'tensorflow' has no attribute 'get_default_graph'```

MrRaymondLee avatar Apr 27 '21 17:04 MrRaymondLee