module 'tensorflow.python.keras.api._v1.keras.layers' has no attribute 'batch_norm'
时间: 2023-10-14 16:06:30 浏览: 72
The error message suggests that there is no attribute called `batch_norm` in the `keras.layers` module of TensorFlow 1.x.
It is possible that you are using an outdated version of TensorFlow, or the attribute has been removed or renamed in a newer version.
In TensorFlow 1.x, the equivalent attribute is `BatchNormalization`. You can try importing it as follows:
```python
from tensorflow.keras.layers import BatchNormalization
```
If you are using TensorFlow 2.x, the attribute is still `BatchNormalization`. However, the import statement would be:
```python
from tensorflow.keras.layers import BatchNormalization
```
Make sure you have the correct version of TensorFlow installed and import the attribute using the correct syntax based on the version you are using.
阅读全文