text: # coding: UTF-8
  from Config.FastText import *
  
  class Model(nn.Module):
      def __init__(self, config):
          super(Model, self).__init__()
          if config.embedding_pretrained is not None:
              self.embedding = nn.Embedding.from_pretrained(config.embedding_pretrained, freeze=False)
          else:
              self.embedding = nn.Embedding(config.n_vocab, config.embed, padding_idx=config.n_vocab - 1)
          self.embedding_ngram2 = nn.Embedding(config.n_gram_vocab, config.embed)
          self.embedding_ngram3 = nn.Embedding(config.n_gram_vocab, config.embed)
          self.dropout = nn.Dropout(config.dropout)
          self.fc1 = nn.Linear(config.embed * 3, config.hidden_size)
          self.fc2 = nn.Linear(config.hidden_size, config.num_classes)
  
      def forward(self, x):
  
          out_word = self.embedding(x[0])
          out_bigram = self.embedding_ngram2(x[2])
          out_trigram = self.embedding_ngram3(x[3])
          out = torch.cat((out_word, out_bigram, out_trigram), -1)
  
          out = out.mean(dim=1)
          out = self.dropout(out)
          out = self.fc1(out)
          out = F.relu(out)
          out = self.fc2(out)
          return out
  