src/transformers/models/trocr/modeling_trocr.py/TrOCRSinusoidalPositionalEmbedding/__init__
class TrOCRSinusoidalPositionalEmbedding:    def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int] = None):
        super().__init__()
        self.offset = 2
        self.embedding_dim = embedding_dim
        self.padding_idx = padding_idx
        self.weights = self.get_embedding(num_positions, embedding_dim, padding_idx)
        self.register_buffer("_float_tensor", torch.FloatTensor(1))