我不明白为什么2 * config.hidden_dim
在编码类中应用全连接层时输入和输出维度的数量(在最后一行中提到)?
class Encoder(nn.Module):
def __init__(self):
super(Encoder, self).__init__()
self.embedding = nn.Embedding(config.vocab_size, config.emb_dim)
init_wt_normal(self.embedding.weight)
self.lstm = nn.LSTM(
config.emb_dim, config.hidden_dim, num_layers=1,
batch_first=True, bidirectional=True)
init_lstm_wt(self.lstm)
self.W_h = nn.Linear(
config.hidden_dim * 2, config.hidden_dim * 2, bias=False)
代码取自https://github.com/atulkum/pointer_summarizer/blob/master/training_ptr_gen/model.py 请解释