AttributeError: ‘Node‘ object has no attribute ‘output

it2023-01-09  57

import keras from keras.layers.normalization import BatchNormalization import tensorflow as tf x = tf.keras.layers.Conv2D(16, kernal, activation='relu', padding='same')(x) x = BatchNormalization()(x)

 

这是因为我既用了Keras里面的BatchNormalization, 又用了tf.keras里面的layer,导致冲突。把他们全部改为从tf.keras的layer或者Keras中的layer就好了,如下代码。

import tensorflow as tf x = tf.keras.layers.Conv2D(16, kernal, activation='relu', padding='same')(x) x = tf.keras.layers.BatchNormalization()(x)

 

最新回复(0)