keras-team / keras-contrib

Keras community contributions
MIT License
1.59k stars 653 forks source link

CRF layer as hidden layer #542

Open phquanta opened 4 years ago

phquanta commented 4 years ago

Just curious, if it is possible to capture inter-dependencies in hidden states by using CRF as middle layer i.e.Model: "sequential_1" as shown below without introducing extra energies and other factors ? Layer (type) Output Shape Param #
lstm_1 (LSTM) (None, None, 256) 358400
crf_1 (CRF) (None, None, 256) 131840
lstm_2 (LSTM) (None, None, 256) 525312
dense_1 (Dense) (None, None, 93) 23901

I need to use it as middle layer for LSTM not to lose its char-based generative ability, otherwise if you use as last layer it easily learns that you need to shift whole sentence to the left.

With Best Regards, Andrei Buin.