class_docstr: Transformer language model.
  
  Arguments:
      transformer_hparams: transformer hyperparameters
      vocab_size: vocabulary size
      max_sequence_length: maximum size of sequence. This
                           is used for positional embedding
      embedding_dropout_prob: dropout probability for embeddings
      num_tokentypes: size of the token-type embeddings. 0 value
                      will ignore this embedding
code: def get_position_embedding_on_this_context_parallel_rank(
      self, position_embedding, seq_dim
  ):
      cp_size = parallel_state.get_context_parallel_world_size()
      cp_rank = parallel_state.get_context_parallel_rank()
      cp_idx = torch.tensor(
          [cp_rank, (2 * cp_size - cp_rank - 1)],
          device=position_embedding.device,
      )
      position_embedding = position_embedding.view(
          *position_embedding.shape[:seq_dim],
          2 * cp_size,
          -1,
          *position_embedding.shape[(seq_dim + 1) :],
      )
      position_embedding = position_embedding.index_select(
          seq_dim, cp_idx
      )
      position_embedding = position_embedding.view(
          *position_embedding.shape[:seq_dim],
          -1,
          *position_embedding.shape[(seq_dim + 2) :],
      )
      return position_embedding
  
imports: from ast import Mod
  import torch
  from nemo.collections.nlp.modules.common.megatron.adapters.parallel_adapters import AdapterName, PromptEncoderAdapterConfig
  from nemo.collections.nlp.modules.common.megatron.layer_type import LayerType
  from nemo.collections.nlp.modules.common.megatron.module import MegatronModule
  from nemo.collections.nlp.modules.common.megatron.position_embedding import ALiBiRelativePositionEmbedding, KERPLERelativePositionEmbedding, RotaryEmbedding, SandwichRelativePositionEmbedding
  from nemo.collections.nlp.modules.common.megatron.transformer import ParallelTransformer
  from nemo.collections.nlp.modules.common.megatron.utils import ApexGuardDefaults, get_linear_layer, init_method_normal, scaled_init_method_normal
  from nemo.collections.nlp.parts import utils_funcs
  from nemo.core import adapter_mixins
label_desc: Use image node_id 3 for calling the TransformerLanguageModel obj's underlying member method code with example usage: obj.get_position_embedding_on_this_context_parallel_rank(position_embedding, seq_dim) and returns: position_embedding