def __init__(self, vocab_size, emb, emb_dim=dimWE, hidden_dim=dimC, lang=0):
    super(EncoderCNN, self).__init__()
    self.lang = lang
    self.word_emb = nn.Embedding(vocab_size, emb_dim)
    self.word_emb.weight.data.copy_(torch.from_numpy(emb))
    self.pos1_emb = nn.Embedding(MaxPos, dimWPE)
    self.pos2_emb = nn.Embedding(MaxPos, dimWPE)
    self.maxPooling = nn.MaxPool1d((SenLen[self.lang] - 2))
    self.emb_dim = (emb_dim + (dimWPE * 2))
    self.hidden_dim = hidden_dim
    self.tanh = nn.Tanh()
    self.conv = nn.Conv1d(self.emb_dim, hidden_dim, filter_size)
    self.dropout = nn.Dropout(p=CNNDropout)
def __init__(self, vocab_size, emb, emb_dim=dimWE, hidden_dim=dimC, lang=0):
    super(EncoderCNN, self).__init__()
    self.lang = lang
    self.word_emb = nn.Embedding(vocab_size, emb_dim)
    self.word_emb.weight.data.copy_(torch.from_numpy(emb))
    self.pos1_emb = nn.Embedding(MaxPos, dimWPE)
    self.pos2_emb = nn.Embedding(MaxPos, dimWPE)
    self.maxPooling = nn.MaxPool1d((SenLen[self.lang] - 2))
    self.emb_dim = (emb_dim + (dimWPE * 2))
    self.hidden_dim = hidden_dim
    self.tanh = nn.Tanh()
    self.conv = nn.Conv1d(self.emb_dim, hidden_dim, filter_size)
    self.dropout = nn.Dropout(p=CNNDropout)