gru_out = Bidirectional(GRU(hiddenlayer_num, return_sequences=True))(embedded)
#Tensor("concat_v2_8:0", shape=(?, ?, 256), dtype=float32)
I use Keras to create a GRU model.I want to gather information from all the node vectors of the GRU model, instead of the last node vector. For example, I need to get the maximum value of each vector, like the image description, but I have no idea on how to do this.
One may use GlobalMaxPooling1D
described here:
gru_out = Bidirectional(GRU(hiddenlayer_num, return_sequences=True))(embedded)
max_pooled = GlobalMaxPooling1D(gru_out)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With