class_docstr: A class containing all of the functions supporting generation, to be used as a mixin in
  :class:`~transformers.PreTrainedModel`.
class_docstr_tok: ["A","class","containing","all","of","the","functions","supporting","generation",",","to","be","used","as","a","mixin","in",":","class",":","`","~transformers.PreTrainedModel","`","."]
code: def _prepare_input_ids_for_generation(
      self,
      bos_token_id: Optional[int],
      encoder_outputs: Optional[ModelOutput],
  ) -> "torch.LongTensor":
      if self.config.is_encoder_decoder and encoder_outputs is not None:
          # make dummy input_ids with value -100, as a sanity check ensuring that they won't be used for encoding
          shape = encoder_outputs.last_hidden_state.size()[:-1]
          return (
              torch.ones(shape, dtype=torch.long, device=self.device)
              * -100
          )
  
      if bos_token_id is None:
          raise ValueError(
              "`bos_token_id` has to be defined when no `input_ids` are provided."
          )
      return (
          torch.ones((1, 1), dtype=torch.long, device=self.device)
          * bos_token_id
      )
  
imports: from dataclasses import dataclass
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
  from .file_utils import ModelOutput
  from .generation_beam_search import BeamScorer, BeamSearchScorer
  from .generation_logits_process import EncoderNoRepeatNGramLogitsProcessor, ForcedBOSTokenLogitsProcessor, ForcedEOSTokenLogitsProcessor, HammingDiversityLogitsProcessor, InfNanRemoveLogitsProcessor, LogitsProcessorList, MinLengthLogitsProcessor, NoBadWordsLogitsProcessor, NoRepeatNGramLogitsProcessor, PrefixConstrainedLogitsProcessor, RepetitionPenaltyLogitsProcessor, TemperatureLogitsWarper, TopKLogitsWarper, TopPLogitsWarper
  from .generation_stopping_criteria import MaxLengthCriteria, MaxNewTokensCriteria, MaxTimeCriteria, StoppingCriteriaList, validate_stopping_criteria
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP.core.log import logger
label_desc: Use image node_id 3 for calling the GenerationMixin obj's underlying member method code with example usage: obj._prepare_input_ids_for_generation(bos_token_id, encoder_outputs) and returns: unknown, unknown