code: def _test_positional_encoding():
      import matplotlib.pyplot as plt
  
      plt.figure(figsize=(15, 5))
      pe = get_positional_encoding(20, 100)
      plt.plot(np.arange(100), pe[:, 0, 4:8].numpy())
      plt.legend(["dim %d" % p for p in [4, 5, 6, 7]])
      plt.title("Positional encoding")
      plt.show()
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/transformers/positional_encoding.py
imports: import math
  import numpy
  import torch
  import torch.nn
label_desc: Use image node_id 2 for calling a global function with example usage: _test_positional_encoding() without return types