How to import keras.engine.topology in Tensorflow?

You can import Layer and InputSpec from TensorFlow as follows:

from tensorflow.python.keras.layers import Layer, InputSpec

UPDATE: 30/10/2019

from tensorflow.keras.layers import Layer, InputSpec

In order to import keras.engine you may try using:

import tensorflow.python.keras.engine

Note: But from tensorflow.python.keras.engine you cannot import topology


In the keras_vggface/models.py file, change the import from:

from keras.engine.topology import get_source_inputs

to:

from keras.utils.layer_utils import get_source_inputs