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
。返回
具有與 inputs
相同形狀的 Softmax 輸出。