【发布时间】:2019-05-10 13:16:46
【问题描述】:
假设我有来自 LSTM 层的以下输出
[0. 0. 0. 0. 0.01843184 0.01929785 0. 0. 0. 0. 0. 0. ]
我想在这个输出上应用 softmax,但我想先屏蔽 0。
当我使用时
mask = Masking(mask_value=0.0)(lstm_hidden)
combined = Activation('softmax')(mask)
它没有工作。有什么想法吗?
更新:隐藏的 LSTM 的输出是(batch_size, 50, 4000)
【问题讨论】:
-
I want to mask 0's first是什么意思?是否仅对值!=0应用softmax? -
@Vlad,是的,这就是我想要做的。
-
@Vlad:我正在使用 keras
-
太好了,你有答案了。