This isn’t strictly a duplicate, but a similar question is found here: AttributeError: module 'keras.engine' has no attribute 'input_layer'
In essence, many of the import and attribute errors from keras come from the fact that keras changes its imports depending on whether you are using a CPU or using a GPU or ASIC. Some of the engine classes don’t get imported in every case.
Instead, use from keras.layers import Layer and use that layer class in place of the one from the engine.
This isn’t strictly a duplicate, but a similar question is found here: https://stackoverflow.com/questions/51186448/attributeerror-module-keras-engine-has-no-attribute-input-layer/55250831
In essence, many of the import and attribute errors from keras come from the fact that keras changes its imports depending on whether you are using a CPU or using a GPU or ASIC. Some of the engine classes don’t get imported in every case.
Instead, use `from keras.layers import Layer` and use that layer class in place of the one from the engine.