class_docstr: Encodes sequences with positional information.
class_docstr_tok: ["Encodes","sequences","with","positional","information","."]
docstr: :param encoding_dim:
      The dimensionality of positional encodings.
  :param max_seq_len:
      The expected maximum sequence length.
docstr_tok: [":","param","encoding_dim",":","The","dimensionality","of","positional","encodings",".",":","param","max_seq_len",":","The","expected","maximum","sequence","length","."]
code: def __init__(
      self, encoding_dim: int, max_seq_len: Optional[int]
  ) -> None:
      """
      :param encoding_dim:
          The dimensionality of positional encodings.
      :param max_seq_len:
          The expected maximum sequence length.
      """
      super().__init__()
  
      self.encoding_dim = encoding_dim
      self.max_seq_len = max_seq_len
  
imports: import math
  from abc import ABC, abstractmethod
  from typing import Optional, final
  import torch
  import torch.nn
  from torch import Tensor
  from torch.nn import Module
  from torch.nn.functional import embedding
  from torch.nn.parameter import Parameter
  from fairseq2.nn.incremental_state import IncrementalStateBag
  from fairseq2.nn.padding import PaddingMask
  from fairseq2.typing import META, DataType, Device, finaloverride
label_desc: Use image node_id 1 to create a new PositionEncoder object from inherited base classes: Module, ABC with example: obj = PositionEncoder(encoding_dim, max_seq_len)