class_docstr: This module produces sinusoidal positional embeddings of any length.
class_docstr_tok: ["This","module","produces","sinusoidal","positional","embeddings","of","any","length","."]
docstr: We are provided embeddings directly. We cannot infer which are padded so just generate sequential position ids.
  
  Args:
      inputs_embeds: torch.Tensor
  
  Returns: torch.Tensor
docstr_tok: ["We","are","provided","embeddings","directly",".","We","can","not","infer","which","are","padded","so","just","generate","sequential","position","ids",".","Args",":","inputs_embeds",":","torch.Tensor","Returns",":","torch.Tensor"]
code: def create_position_ids_from_inputs_embeds(
      self, inputs_embeds, past_key_values_length
  ):
      """
      We are provided embeddings directly. We cannot infer which are padded so just generate sequential position ids.
  
      Args:
          inputs_embeds: torch.Tensor
  
      Returns: torch.Tensor
      """
      input_shape = inputs_embeds.size()[:-1]
      sequence_length = input_shape[1]
  
      position_ids = torch.arange(
          self.padding_idx + 1,
          sequence_length + self.padding_idx + 1,
          dtype=torch.long,
          device=inputs_embeds.device,
      )
      return (
          position_ids.unsqueeze(0).expand(input_shape).contiguous()
          + past_key_values_length
      )
  
imports: import math
  import random
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn
  from torch.nn import CrossEntropyLoss
  from ...activations import ACT2FN
  from ...deepspeed import is_deepspeed_zero3_enabled
  from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_end_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_m2m_100 import M2M100Config
label_desc: Use image node_id 5 for calling the M2M100SinusoidalPositionalEmbedding obj's underlying member method code with example usage: obj.create_position_ids_from_inputs_embeds(inputs_embeds, past_key_values_length) and returns: unknown