Softmax 类keras.layers.Softmax(axis=-1, **kwargs)
Softmax 激活层。
公式
exp_x = exp(x - max(x))
f(x) = exp_x / sum(exp_x)
示例
>>> softmax_layer = keras.layers.Softmax()
>>> input = np.array([1.0, 2.0, 1.0])
>>> result = softmax_layer(input)
>>> result
[0.21194157, 0.5761169, 0.21194157]
参数
name 和 dtype。调用参数
inputs 形状相同的布尔掩码。掩码指定1表示保留,0表示屏蔽。默认为 None。返回
Softmax 处理后的输出,形状与 inputs 相同。