code: def add_positional_embeddings(x_tokens_dict, positional_embedding):
      """Add positional encodings."""
      if positional_embedding in ["sinusoidal_1d", "learned_1d"]:
          for key, x_tokens_ in x_tokens_dict.items():
              x_tokens_ = model_utils.add_positional_embeddings(
                  x_tokens_,
                  positional_embedding,
                  input_shape=x_tokens_.shape,
                  layer_name=f"posembed_input_{key}",
              )
              x_tokens_dict[key] = x_tokens_
      else:
          raise ValueError(
              "Only 1d positional embdedding are supported!"
          )
  
      return x_tokens_dict
  
imports: import functools
  from typing import Any, Dict, Optional, Tuple
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import model_utils
  from scenic.model_lib.layers import nn_layers
  from scenic.projects.av_mae import base_model
  from scenic.projects.av_mae import model_utils
  from scenic.projects.mbt import model
  from scenic.projects.vivit import model
  from scenic.projects.vivit import model_utils
label_desc: Use image node_id 3 for calling a global function with example usage: add_positional_embeddings(x_tokens_dict, positional_embedding) and returns: x_tokens_dict