def __init__(self, input_size, hidden_size):
     super(SentenceEncoder, self).__init__()
     self.encoder = StackedBRNN(input_size=input_size,
                                hidden_size=hidden_size,
                                num_layers=1,
                                dropout_rate=0.5,
                                dropout_output=True,
                                concat_layers=False,
                                rnn_type=nn.LSTM,
                                padding=True)
Exemple #2
0
 def __init__(self, args, embed_size):
     super(SentenceEncoder, self).__init__()
     rnn_type = nn.LSTM if args.rnn_encoder == 'lstm' else nn.GRU
     self.encoder = StackedBRNN(input_size=embed_size,
                                hidden_size=args.hidden_size,
                                num_layers=args.num_layers,
                                dropout_rate=args.dropout,
                                dropout_output=True,
                                concat_layers=False,
                                rnn_type=rnn_type,
                                padding=True)