一、自定义网络层layer 继承tf.keras.layers.Layer类 使用tf.keras.layers.Lambda类 下面这个例子就包含了以上两种形式: import numpy as np from tensorflow import keras class CustomizedDenseLayer(keras.layers.Layer): def __init__(self, units, activation