tf.keras.layers.Lambda documentation explains how a function can be defined in a lambda layer. That document provides the following function as an example,
def antirectifier(x):
x -= K.mean(x, axis=1, keepdims=True)
x = K.l2_normalize(x, axis=1)
pos = K.relu(x)
neg = K.relu(-x)
return K.concatenate([pos, neg], axis=1)
model.add(Lambda(antirectifier))
But according to that, tf.keras.backend must be used to conduct operations on the input Tensor object.
Is there any way we can use default python packages and user-defined function to define the steps of a lambda function.
If it's possible, please be kind enough to provide some examples.