code: def PositionalEmbeddingCreator(
      num_embeddings,
      embedding_dim,
      padding_idx,
      left_pad,
      learned=False,
  ):
      if learned:
          m = LearnedPositionalEmbedding(
              num_embeddings + padding_idx + 1,
              embedding_dim,
              padding_idx,
          )
          nn.init.normal_(m.weight, mean=0, std=embedding_dim**-0.5)
          nn.init.constant_(m.weight[padding_idx], 0)
      else:
          m = SinusoidalPositionalEmbedding(
              embedding_dim=embedding_dim,
              padding_idx=padding_idx,
              init_size=num_embeddings + padding_idx + 1,
          )
      return m
  
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import options, utils
  from fairseq.models import FairseqEncoderDecoderModel, FairseqIncrementalDecoder, register_model, register_model_architecture, transformer
  from fairseq.modules import AdaptiveSoftmax, LearnedPositionalEmbedding, MultiheadAttention, SinusoidalPositionalEmbedding
  from pytorch_translate import transformer, vocab_reduction
  from pytorch_translate.average_attention import AverageAttention, AverageWindowAttention
  from pytorch_translate.utils import torch_find
label_desc: Use image node_id 4 for calling a global function with example usage: PositionalEmbeddingCreator(num_embeddings, embedding_dim, padding_idx, left_pad, learned) and returns: m