docstr: labels (:obj:`torch.LongTensor` of shape :obj:`(batch_size,)`, `optional`):
      Labels for computing the sequence classification/regression loss. Indices should be in :obj:`[0, ...,
      config.num_labels - 1]`. If :obj:`config.num_labels > 1` a classification loss is computed (Cross-Entropy).
docstr_tok: ["labels","(",":","obj",":","`","torch.LongTensor","`","of","shape",":","obj",":","`","(","batch_size",",",")","`",",","`","optional","`",")",":","Labels","for","computing","the","sequence","classification\/regression","loss",".","Indices","should","be","in",":","obj",":","`","[","0",",","...",",","config.num_labels","-","1","]","`",".","If",":","obj",":","`","config.num_labels",">","1","`","a","classification","loss","is","computed","(","Cross-Entropy",")","."]
code: def forward(
      self,
      input_ids=None,
      attention_mask=None,
      decoder_input_ids=None,
      decoder_attention_mask=None,
      head_mask=None,
      decoder_head_mask=None,
      cross_attn_head_mask=None,
      encoder_outputs=None,
      inputs_embeds=None,
      decoder_inputs_embeds=None,
      use_cache=None,
      output_attentions=None,
      output_hidden_states=None,
      return_dict=None,
      past_key_values=None,
      head=None,
      output_adapter_gating_scores=False,
      output_adapter_fusion_attentions=False,
      **kwargs,
  ):
      r"""
      labels (:obj:`torch.LongTensor` of shape :obj:`(batch_size,)`, `optional`):
          Labels for computing the sequence classification/regression loss. Indices should be in :obj:`[0, ...,
          config.num_labels - 1]`. If :obj:`config.num_labels > 1` a classification loss is computed (Cross-Entropy).
      """
      return_dict = (
          return_dict
          if return_dict is not None
          else self.config.use_return_dict
      )
  
      if (
          "labels" in kwargs
          or "start_positions" in kwargs
          and "end_positions" in kwargs
      ):
          use_cache = False
  
      outputs, context = self.model(
          input_ids,
          attention_mask=attention_mask,
          decoder_input_ids=decoder_input_ids,
          decoder_attention_mask=decoder_attention_mask,
          head_mask=head_mask,
          decoder_head_mask=decoder_head_mask,
          cross_attn_head_mask=cross_attn_head_mask,
          encoder_outputs=encoder_outputs,
          inputs_embeds=inputs_embeds,
          decoder_inputs_embeds=decoder_inputs_embeds,
          use_cache=use_cache,
          output_attentions=output_attentions,
          output_hidden_states=output_hidden_states,
          return_dict=return_dict,
          past_key_values=past_key_values,
          output_adapter_gating_scores=output_adapter_gating_scores,
          output_adapter_fusion_attentions=output_adapter_fusion_attentions,
          adapter_input_parallelized=kwargs.pop(
              "adapter_input_parallelized", False
          ),
          output_context=True,
      )
      # required e.g. for prompt tuning in all models
      kwargs["context"] = context
      # sequence classification based on last token in sequence
      x = outputs[0]  # last hidden state
      if input_ids is not None and x.shape[1] == input_ids.shape[1]:
          eos_mask = input_ids.eq(self.config.eos_token_id)
          (eos_mask,) = adjust_tensors_for_parallel(x, eos_mask)
          if len(torch.unique(eos_mask.sum(1))) > 1:
              raise ValueError(
                  "All examples must have the same number of <eos> tokens."
              )
          cls_representation = x[eos_mask, :].view(
              x.size(0), -1, x.size(-1)
          )[:, -1, :]
      else:
          cls_representation = x
  
      head_outputs = self.forward_head(
          outputs,
          head_name=head,
          cls_output=cls_representation,
          attention_mask=attention_mask,
          return_dict=return_dict,
          **kwargs,
      )
  
      return head_outputs
  
imports: import torch
  from transformers.models.mbart.modeling_mbart import MBART_INPUTS_DOCSTRING, MBART_START_DOCSTRING, MBartConfig, MBartModel, MBartPreTrainedModel, shift_tokens_right
  from transformers.utils import add_start_docstrings, add_start_docstrings_to_model_forward
  from ...composition import adjust_tensors_for_parallel
  from ...heads import ClassificationHead, ModelWithFlexibleHeadsAdaptersMixin, MultiLabelClassificationHead, QuestionAnsweringHead, Seq2SeqLMHead
  from ...model_mixin import EmbeddingAdaptersWrapperMixin
  from ...wrappers import init
label_desc: Use image node_id 4 for calling the MBartAdapterModel obj's underlying member method code with example usage: obj.forward(input_ids, attention_mask, decoder_input_ids, decoder_attention_mask, head_mask, decoder_head_mask, cross_attn_head_mask, encoder_outputs, inputs_embeds, decoder_inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict, past_key_values, head, output_adapter_gating_scores, output_adapter_fusion_attentions) and returns: head_outputs