I'm trying to recreate this architecture.
The model has embeddings and LSTM layer followed by pooling layer.
I'm stuck on how to pool multiple LSTM outputs. (not pooling time sequence).
for example, if the LSTM input sequences are:
Start1 - A - B - C - End1
Start1 - C - D - E - End1
I want this 2 sequence LSTM-outputs to be pooled first (as prediction output (max or avg)) before the LSTM take the learning step.
(Pooled because they have the same start and end).
I expect something like this:
input_layer = Input()
x = Embedding()(input_layer)
x = LSTM()(x)
output = ConditionalPooling()(x)
The question is how to implement the ConditionalPooling
, where ConditionalPooling
is a function to group sequences output which has the same head and tails.
Thank you :)