解决:use the Lambda layer to wrap your tensorflow operations,this is what I did:
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);