docstr: labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
      Labels for computing the multiple choice classification loss. Indices should be in `[0, ...,
      num_choices-1]` where `num_choices` is the size of the second dimension of the input tensors. (See
      `input_ids` above)
docstr_tok: ["labels","(","`","torch.LongTensor","`","of","shape","`","(","batch_size",",",")","`",",","*","optional","*",")",":","Labels","for","computing","the","multiple","choice","classification","loss",".","Indices","should","be","in","`","[","0",",","...",",","num_choices-1","]","`","where","`","num_choices","`","is","the","size","of","the","second","dimension","of","the","input","tensors",".","(","See","`","input_ids","`","above",")"]
code: def forward(
      self,
      input_ids: Optional[torch.Tensor] = None,
      attention_mask: Optional[torch.Tensor] = None,
      position_ids: Optional[torch.Tensor] = None,
      head_mask: Optional[torch.Tensor] = None,
      inputs_embeds: Optional[torch.Tensor] = None,
      labels: Optional[torch.Tensor] = None,
      output_attentions: Optional[bool] = None,
      output_hidden_states: Optional[bool] = None,
      return_dict: Optional[bool] = True,
  ) -> Union[Tuple[torch.FloatTensor], MultipleChoiceModelOutput]:
      r"""
      labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
          Labels for computing the multiple choice classification loss. Indices should be in `[0, ...,
          num_choices-1]` where `num_choices` is the size of the second dimension of the input tensors. (See
          `input_ids` above)
      """
      return_dict = (
          return_dict
          if return_dict is not None
          else self.config.use_return_dict
      )
      num_choices = (
          input_ids.shape[1]
          if input_ids is not None
          else inputs_embeds.shape[1]
      )
  
      input_ids = (
          input_ids.view(-1, input_ids.size(-1))
          if input_ids is not None
          else None
      )
      attention_mask = (
          attention_mask.view(-1, attention_mask.size(-1))
          if attention_mask is not None
          else None
      )
      position_ids = (
          position_ids.view(-1, position_ids.size(-1))
          if position_ids is not None
          else None
      )
      inputs_embeds = (
          inputs_embeds.view(
              -1, inputs_embeds.size(-2), inputs_embeds.size(-1)
          )
          if inputs_embeds is not None
          else None
      )
  
      outputs = self.ernie_m(
          input_ids,
          attention_mask=attention_mask,
          position_ids=position_ids,
          head_mask=head_mask,
          inputs_embeds=inputs_embeds,
          output_attentions=output_attentions,
          output_hidden_states=output_hidden_states,
          return_dict=return_dict,
      )
  
      pooled_output = outputs[1]
  
      pooled_output = self.dropout(pooled_output)
      logits = self.classifier(pooled_output)
      reshaped_logits = logits.view(-1, num_choices)
  
      loss = None
      if labels is not None:
          loss_fct = CrossEntropyLoss()
          loss = loss_fct(reshaped_logits, labels)
  
      if not return_dict:
          output = (reshaped_logits,) + outputs[2:]
          return ((loss,) + output) if loss is not None else output
  
      return MultipleChoiceModelOutput(
          loss=loss,
          logits=reshaped_logits,
          hidden_states=outputs.hidden_states,
          attentions=outputs.attentions,
      )
  
imports: import math
  from typing import List, Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn, tensor
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
  from ...modeling_utils import PreTrainedModel
  from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
  from .configuration_ernie_m import ErnieMConfig
label_desc: Use image node_id 2 for calling the ErnieMForMultipleChoice obj's underlying member method code with example usage: obj.forward(input_ids, attention_mask, position_ids, head_mask, inputs_embeds, labels, output_attentions, output_hidden_states, return_dict) and returns: MultipleChoiceModelOutput, unknown