我找到了解决该问题的方法。对于遇到相同问题的任何人,您都可以使用Lambda层包装张量流操作,这就是我所做的:
from tensorflow.python.keras.layers import Lambda;def norm(fc2): fc2_norm = K.l2_normalize(fc2, axis = 3); illum_est = tf.reduce_sum(fc2_norm, axis = (1, 2)); illum_est = K.l2_normalize(illum_est); return illum_est;illum_est = Lambda(norm)(fc2);



