AttributeError: module 'keras.engine' has no attribute 'Layer'
时间: 2023-09-20 22:07:28 浏览: 152
问题解决:AttributeError: module ‘paddle.fluid’ has no attribute ‘EndStepEvent’
5星 · 资源好评率100%
This error occurs when you try to use a method or attribute that does not exist in the module you are importing. In this case, it seems that you are trying to use a Layer attribute from the keras.engine module, but it does not exist.
One possible solution is to check that you have imported the right module and that it is up-to-date. You can also try to update your Keras installation using pip:
```python
pip install --upgrade keras
```
If the problem persists, you may want to try importing the Layer attribute from a different module, such as keras.layers:
```python
from keras.layers import Layer
```
This should allow you to use the Layer attribute without encountering the AttributeError.
阅读全文