def projection(encoding, W, dropout_rate):
"""Projection layer. Dense layer from keras.
In FastQA is applied after the encoder, to project context and question representations
into different spaces."""
proj = TimeDistributed(
Dense(W,
trainable=True,
weights=np.concatenate((np.eye(W), np.eye(W)), axis=1)))(encoding)
proj = Dropout(rate=dropout_rate)(proj)
return proj
评论列表
文章目录