code: def test_lambda_keras(self):
      layers = [
          tf.keras.layers.Dense(10, activation=tf.nn.relu),
          tf.keras.layers.Dense(5, activation=tf.nn.sigmoid),
          tf.keras.layers.Dense(1, activation=tf.identity),
      ]
      perceptron = tf.keras.Sequential(layers)
      # in order to get trainable_variables of keras
      _ = perceptron(np.random.random([100, 5]).astype(np.float32))
  
      class CustomizeModel(tl.models.Model):
          def __init__(self):
              super(CustomizeModel, self).__init__()
              self.dense = tl.layers.Dense(in_channels=1, n_units=5)
              self.lambdalayer = tl.layers.Lambda(
                  perceptron, perceptron.trainable_variables
              )
  
          def forward(self, x):
              z = self.dense(x)
              z = self.lambdalayer(z)
              return z
  
      optimizer = tf.optimizers.Adam(learning_rate=0.1)
  
      model = CustomizeModel()
      print(model.lambdalayer)
  
      model.train()
  
      for epoch in range(10):
          with tf.GradientTape() as tape:
              pred_y = model(self.data_x)
              loss = tl.cost.mean_squared_error(pred_y, self.data_y)
  
          gradients = tape.gradient(loss, model.trainable_weights)
          optimizer.apply_gradients(
              zip(gradients, model.trainable_weights)
          )
  
          print("epoch %d, loss %f" % (epoch, loss))
  
file_path: TensorLayer/tests/layers/test_layers_lambda.py
imports: import os
  import unittest
  import numpy
  import tensorflow
  import tensorlayer
  from tests.utils import CustomTestCase
label_desc: Use image node_id 3 for calling the Layer_Lambda_Test obj's underlying member method code with example usage: obj.test_lambda_keras() and returns: z