class_docstr: The basic pretrained model for QA. It is used in the original BERT paper for SQuAD 1.1.
  
  Here, we directly use the backbone network to extract the contextual embeddings and use
  another dense layer to map the contextual embeddings to the start scores and end scores.
  
  use_segmentation is used to mark whether we segment the input sentence. In RoBERTa and XLMR,
  this flag is set to True, then the QA model no longer accept `token_types` as valid input.
  
  - use_segmentation=True:
      tokens :      <CLS> Question <SEP> Context <SEP>
      token_typess:  0       0       0      1      1
  
  - use_segmentation=False:
      tokens :      <CLS> Question <SEP> Context <SEP>
      token_typess:  None
class_docstr_tok: ["The","basic","pretrained","model","for","QA",".","It","is","used","in","the","original","BERT","paper","for","SQuAD","1.1",".","Here",",","we","directly","use","the","backbone","network","to","extract","the","contextual","embeddings","and","use","another","dense","layer","to","map","the","contextual","embeddings","to","the","start","scores","and","end","scores",".","use_segmentation","is","used","to","mark","whether","we","segment","the","input","sentence",".","In","RoBERTa","and","XLMR",",","this","flag","is","set","to","True",",","then","the","QA","model","no","longer","accept","`","token_types","`","as","valid","input",".","-","use_segmentation=True",":","tokens",":","<","CLS",">","Question","<","SEP",">","Context","<","SEP",">","token_typess",":","0","0","0","1","1","-","use_segmentation=False",":","tokens",":","<","CLS",">","Question","<","SEP",">","Context","<","SEP",">","token_typess",":","None"]
code: def __init__(
      self,
      backbone,
      weight_initializer=None,
      bias_initializer=None,
      use_segmentation=True,
  ):
      super().__init__()
  
      self.backbone = backbone
      self.use_segmentation = use_segmentation
      self.qa_outputs = nn.Dense(
          units=2,
          flatten=False,
          weight_initializer=weight_initializer,
          bias_initializer=bias_initializer,
      )
  
file_path: gluon-nlp/scripts/question_answering/models.py
imports: import mxnet
  from mxnet import np, npx
  from mxnet.gluon import nn, HybridBlock
  from mxnet.util import use_np
  from gluonnlp.layers import get_activation
  from gluonnlp.op import select_vectors_by_position
  from gluonnlp.attention_cell import masked_logsoftmax, masked_softmax
label_desc: Use image node_id 1 to create a new ModelForQABasic object from inherited base classes: HybridBlock with example: obj = ModelForQABasic(backbone, weight_initializer, bias_initializer, use_segmentation)