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 具有相同的形状。