References 
Keras-Lambda 
Unable to output custom layer 
Exception: Output tensors to a Model must be Keras tensors. #4428 
Output tensors to a Model must be Keras tensors. Found: Tensor #6263 
How to use lambda layer in keras?
How to transform a tensorflow tensor to keras tensor? 
Keras-Lambda
keras.layers.Lambda(function, output_shape=None, mask=None, arguments=None)Assume TF is a tensorflow tensor, in oreder to transform tensorflow tensor to keras tensor, 
 there are three steps you need to do:
Three steps:
1 Define the FUNCTION you get the TF expression 
 2 Wrap your function with FUNCTION with Lambda(FUNCTION) 
 3 Add your INPUT-TENSOR after Lambda(FUNCTION)(INPUT-TENSOR)
NOTE:
It seems that you can only input one parameter as INPUT-TENSOR, 
 if you have more than one input say two input expressions input-a and input-b, 
 you should use [input-a,input-b], the list expression to set them as as one. 
 If you want to return more than two keras tensors, return [tf-tensor-a,tf-tensor-b] at the end of your FUNCTION
An Example
import tensorflow as tf
from keras import backend as K
from keras.layers import Lambda
last_hidden_tf = tf.placeholder(tf.float32,shape=(None,4))
baseline_output_tf = tf.placeholder(tf.float32,shape=(None,3))
def my_channnel(para): #last = last_hidden
    last = para[0]
    base = para[1]
    with tf.name_scope('Channel_Simple'):
        bs = tf.Variable(bias_weights.astype('float32'),name='cm-complex')
        wt = tf.Variable(W*(np.random.random((nhidden,nb_classes)) - 0.5).astype('float32'),name='cm-complex-weight')
        # transfor input_layer shape from 300(nhidden) to 10(nb_classes)
        t = tf.matmul(last,wt) # input_layer is baseline_output
        # add t and with each row of bs
        a  = [tf.nn.softmax(t+bs[i,:]) for i in range(nb_classes)]
        # reshape a to c and get tensor with shape [batch_num,nb_classes,mb_classes], each row sums to 1
        channel_matrix = tf.reshape(a,[-1,nb_classes,nb_classes],name='c')
        channeled_output = K.batch_dot(base,channel_matrix,axes=[1,1]) 
        return [channel_matrix,channeled_output]
[channel_matrix,channeled_output] = Lambda(my_channnel)([last_hidden,baseline_output])
print(channel_matrix)
print(channeled_output)Tensor("lambda_7/Channel_Simple/c:0", shape=(?, 3, 3), dtype=float32)
Tensor("lambda_7/Channel_Simple/Squeeze:0", shape=(?, 3), dtype=float32)# model = Model(inputs = [last_hidden,baseline_output],outputs = [channel_matrix,channeled_output])
# a = model.predict([last_hidden_data,baseline_output_data])
model = Model(inputs = [last_hidden,baseline_output],outputs = [channel_matrix,channeled_output])
a = model.predict([last_hidden_data,baseline_output_data])
print(a[0])
print(a[1])[[[ 0.09003057  0.24472848  0.66524094]
  [ 0.09003057  0.24472848  0.66524094]
  [ 0.09003057  0.24472848  0.66524094]]]
[[ 0.27009171  0.73418546  1.99572277]]                










