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 forward(self, ids: paddle.Tensor, labels: paddle.Tensor = None):
      # Shape: (batch_size, num_tokens, embedding_dim)
      embedded_text = self.embedder(ids)
  
      # Shape: (batch_size, embedding_dim)
      summed = self.bow_encoder(embedded_text)
      summed = self.dropout(summed)
      encoded_text = paddle.tanh(summed)
  
      # Shape: (batch_size, hidden_size)
      fc1_out = paddle.tanh(self.fc1(encoded_text))
      # Shape: (batch_size, fc_hidden_size)
      fc2_out = paddle.tanh(self.fc2(fc1_out))
      # Shape: (batch_size, num_classes)
      logits = self.output_layer(fc2_out)
  
      probs = F.softmax(logits, axis=1)
      if labels is not None:
          loss = self.criterion(logits, labels)
          correct = self.metric.compute(probs, labels)
          acc = self.metric.update(correct)
          return probs, loss, {"acc": acc}
      else:
          return probs
  
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 4 for calling the BoWModel obj's underlying member method code with example usage: obj.forward(ids, labels) and returns: probs,  loss,  dict, probs