how to use tf operations in keras models
问题 I am trying to us tensorflow operations within a keras model and I am quite confused about the mechanism and what Lambda layers do to tf tensors. So this works: a = keras.layers.Input(shape=[1, 2], dtype='float', name='a') s= keras.layers.Lambda(lambda x: tf.transpose(tf.transpose(x)))(a) model = keras.models.Model(inputs=a, outputs=s) but this does not work: a = keras.layers.Input(shape=[1, 2], dtype='float', name='a') s = tf.transpose(tf.transpose(a)) s = keras.layers.Lambda(lambda x: x)(s)