class_docstr: This class implements the Bag of Words Classification Network model to classify texts.
  At a high level, the model starts by embedding the tokens and running them through
  a word embedding. Then, we encode these epresentations with a `BoWEncoder`.
  Lastly, we take the output of the encoder to create a final representation,
  which is passed through some feed-forward layers to output a logits (`output_layer`).
  Args:
      vocab_size (obj:`int`): The vocabulary size.
      emb_dim (obj:`int`, optional, defaults to 300):  The embedding dimension.
      hidden_size (obj:`int`, optional, defaults to 128): The first full-connected layer hidden size.
      fc_hidden_size (obj:`int`, optional, defaults to 96): The second full-connected layer hidden size.
      num_classes (obj:`int`): All the labels that the data has.
class_docstr_tok: ["This","class","implements","the","Bag","of","Words","Classification","Network","model","to","classify","texts",".","At","a","high","level",",","the","model","starts","by","embedding","the","tokens","and","running","them","through","a","word","embedding",".","Then",",","we","encode","these","epresentations","with","a","`","BoWEncoder","`",".","Lastly",",","we","take","the","output","of","the","encoder","to","create","a","final","representation",",","which","is","passed","through","some","feed-forward","layers","to","output","a","logits","(","`","output_layer","`",")",".","Args",":","vocab_size","(","obj",":","`","int","`",")",":","The","vocabulary","size",".","emb_dim","(","obj",":","`","int","`",",","optional",",","defaults","to","300",")",":","The","embedding","dimension",".","hidden_size","(","obj",":","`","int","`",",","optional",",","defaults","to","128",")",":","The","first","full-connected","layer","hidden","size",".","fc_hidden_size","(","obj",":","`","int","`",",","optional",",","defaults","to","96",")",":","The","second","full-connected","layer","hidden","size",".","num_classes","(","obj",":","`","int","`",")",":","All","the","labels","that","the","data","has","."]
code: def __init__(
      self,
      num_classes: int = 2,
      embedder: TokenEmbedding = None,
      tokenizer: JiebaTokenizer = None,
      hidden_size: int = 128,
      fc_hidden_size: int = 96,
      load_checkpoint: str = None,
      label_map: dict = None,
  ):
      super().__init__()
      self.embedder = embedder
      self.tokenizer = tokenizer
      self.label_map = label_map
  
      emb_dim = self.embedder.embedding_dim
      self.bow_encoder = nlp.seq2vec.BoWEncoder(emb_dim)
      self.fc1 = nn.Linear(
          self.bow_encoder.get_output_dim(), hidden_size
      )
      self.fc2 = nn.Linear(hidden_size, fc_hidden_size)
      self.dropout = nn.Dropout(p=0.3, axis=1)
      self.output_layer = nn.Linear(fc_hidden_size, num_classes)
      self.criterion = nn.loss.CrossEntropyLoss()
      self.metric = paddle.metric.Accuracy()
  
      if load_checkpoint is not None and os.path.isfile(
          load_checkpoint
      ):
          state_dict = paddle.load(load_checkpoint)
          self.set_state_dict(state_dict)
          logger.info(
              "Loaded parameters from %s"
              % os.path.abspath(load_checkpoint)
          )
  
file_path: PaddleHub/demo/text_classification/embedding/model.py
imports: import os
  from typing import List
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import paddlenlp
  from paddlenlp.embeddings import TokenEmbedding
  from paddlenlp.data import JiebaTokenizer
  from paddlehub.utils.log import logger
  from paddlehub.utils.utils import pad_sequence, trunc_sequence
label_desc: Use image node_id 1 to create a new BoWModel object from inherited base classes: nn with example: obj = BoWModel(num_classes, embedder, tokenizer, hidden_size, fc_hidden_size, load_checkpoint, label_map)