class_docstr: An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
  models.
class_docstr_tok: ["An","abstract","class","to","handle","weights","initialization","and","a","simple","interface","for","downloading","and","loading","pretrained","models","."]
code: def _shift_right(self, input_ids):
      decoder_start_token_id = self.config.decoder_start_token_id
      pad_token_id = self.config.pad_token_id
  
      if decoder_start_token_id is None:
          raise ValueError(
              "self.model.config.decoder_start_token_id has to be defined. In T5 it is usually set to the pad_token_id. "
              "See T5 docs for more information."
          )
  
      # shift inputs to the right
      if is_torch_fx_proxy(input_ids):
          # Item assignment is not supported natively for proxies.
          shifted_input_ids = torch.full(
              input_ids.shape[:-1] + (1,), decoder_start_token_id
          )
          shifted_input_ids = torch.cat(
              [shifted_input_ids, input_ids[..., :-1]], dim=-1
          )
      else:
          shifted_input_ids = input_ids.new_zeros(input_ids.shape)
          shifted_input_ids[..., 1:] = input_ids[..., :-1].clone()
          shifted_input_ids[..., 0] = decoder_start_token_id
  
      if pad_token_id is None:
          raise ValueError(
              "self.model.config.pad_token_id has to be defined."
          )
      # replace possible -100 values in labels by `pad_token_id`
      shifted_input_ids.masked_fill_(
          shifted_input_ids == -100, pad_token_id
      )
  
      return shifted_input_ids
  
imports: import copy
  from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn
  from ...activations import ACT2FN
  from ...modeling_outputs import MoECausalLMOutputWithPast, MoEModelOutputWithPastAndCrossAttentions
  from ...modeling_utils import PreTrainedModel
  from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, add_start_docstrings_to_model_forward, is_torch_fx_proxy, logging
  from .configuration_gptsan_japanese import GPTSanJapaneseConfig
label_desc: Use image node_id 3 for calling the GPTSanJapanesePreTrainedModel obj's underlying member method code with example usage: obj._shift_right(input_ids) and returns: shifted_input_ids