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 _batchify(
      self, data: List[List[str]], max_seq_len: int, batch_size: int
  ):
      examples = []
      for item in data:
          ids = self.tokenizer.encode(sentence=item[0])
  
          if len(ids) > max_seq_len:
              ids = trunc_sequence(ids, max_seq_len)
          else:
              pad_token = self.tokenizer.vocab.pad_token
              pad_token_id = self.tokenizer.vocab.to_indices(pad_token)
              ids = pad_sequence(ids, max_seq_len, pad_token_id)
          examples.append(ids)
  
      # Seperates data into some batches.
      one_batch = []
      for example in examples:
          one_batch.append(example)
          if len(one_batch) == batch_size:
              yield one_batch
              one_batch = []
      if one_batch:
          # The last batch whose size is less than the config batch_size setting.
          yield one_batch
  
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 5 for calling the BoWModel obj's underlying member method code with example usage: obj._batchify(data, max_seq_len, batch_size) without return types