def __init__(self, **kwargs):
    super(BiLSTM, self).__init__()
    for k in kwargs:
        self.__setattr__(k, kwargs[k])
    V = self.embed_num
    D = self.embed_dim
    C = self.label_num
    paddingId = self.paddingId
    self.embed = nn.Embedding(V, D, padding_idx=paddingId)
    if self.pretrained_embed:
        self.embed.weight.data.copy_(self.pretrained_weight)
    else:
        init_embedding(self.embed.weight)
    self.dropout_embed = nn.Dropout(self.dropout_emb)
    self.dropout = nn.Dropout(self.dropout)
    self.bilstm = nn.LSTM(input_size=D, hidden_size=self.lstm_hiddens, num_layers=self.lstm_layers, bidirectional=True, batch_first=True, bias=True)
    self.linear = nn.Linear(in_features=(self.lstm_hiddens * 2), out_features=C, bias=True)
    init_linear(self.linear)
def __init__(self, **kwargs):
    super(BiLSTM, self).__init__()
    for k in kwargs:
        self.__setattr__(k, kwargs[k])
    V = self.embed_num
    D = self.embed_dim
    C = self.label_num
    paddingId = self.paddingId
    self.embed = nn.Embedding(V, D, padding_idx=paddingId)
    if self.pretrained_embed:
        self.embed.weight.data.copy_(self.pretrained_weight)
    else:
        init_embedding(self.embed.weight)
    self.dropout_embed = nn.Dropout(self.dropout_emb)
    self.dropout = nn.Dropout(self.dropout)
    self.bilstm = nn.LSTM(input_size=D, hidden_size=self.lstm_hiddens, num_layers=self.lstm_layers, bidirectional=True, batch_first=True, bias=True)
    self.linear = nn.Linear(in_features=(self.lstm_hiddens * 2), out_features=C, bias=True)
    init_linear(self.linear)