code: def get_positional_embedding(
      units, max_length=None, embed_method="learn_sinusoidal"
  ):
      if embed_method == "sinusoidal":
          return SinusoidalPositionalEmbedding(units, learnable=False)
      elif embed_method == "learned_sinusoidal":
          return SinusoidalPositionalEmbedding(units, learnable=True)
      elif embed_method == "learned":
          return nn.Embedding(
              num_embeddings=max_length, embedding_dim=units
          )
  
imports: import math
  from collections import OrderedDict
  import torch
  import numpy
  from torch import nn
  from typing import Union
  from .utils import to_torch_dtype
label_desc: Use image node_id 5 for calling a global function with example usage: get_positional_embedding(units, max_length, embed_method) and returns: SinusoidalPositionalEmbedding, SinusoidalPositionalEmbedding, nn