Minimum
classkeras.layers.Minimum(**kwargs)
计算输入列表中元素逐位的最小值.
它接受一个形状相同的张量列表作为输入, 并返回一个形状相同的单个张量.
示例:
>>> input_shape = (2, 3, 4)
>>> x1 = np.random.rand(*input_shape)
>>> x2 = np.random.rand(*input_shape)
>>> y = keras.layers.Minimum()([x1, x2])
在 Keras 模型中的用法:
>>> input1 = keras.layers.Input(shape=(16,))
>>> x1 = keras.layers.Dense(8, activation='relu')(input1)
>>> input2 = keras.layers.Input(shape=(32,))
>>> x2 = keras.layers.Dense(8, activation='relu')(input2)
>>> # 等价于 `y = keras.layers.minimum([x1, x2])`
>>> y = keras.layers.Minimum()([x1, x2])
>>> out = keras.layers.Dense(4)(y)
>>> model = keras.models.Model(inputs=[input1, input2], outputs=out)