def __init__(self, d_model: int, max_shape: Tuple[int, int] = (256, 256), temp_bug_fix: bool = True) -> None:
        """Construct sinusoidal positional encoding.

        Args:
        d_model: Dimensions of model input.
        max_shape (tuple): for 1/8 featmap, the max length of 256 corresponds to 2048 pixels
        temp_bug_fix (bool): As noted in this [issue](https://github.com/zju3dv/LoFTR/issues/41),
            the original implementation of LoFTR includes a bug in the pos-enc impl, which has little impact
            on the final performance. For now, we keep both impls for backward compatibility.
            We will remove the buggy impl after re-training all variants of our released models.

        """
        super().__init__()
        self.d_model = d_model
        self.temp_bug_fix = temp_bug_fix

        pe = self._create_position_encoding(max_shape)
        self.register_buffer("pe", pe, persistent=False)  # [1, C, H, W]
Construct sinusoidal positional encoding.

        Args:
        d_model: Dimensions of model input.
        max_shape (tuple): for 1/8 featmap, the max length of 256 corresponds to 2048 pixels
        temp_bug_fix (bool): As noted in this [issue](https://github.com/zju3dv/LoFTR/issues/41),
            the original implementation of LoFTR includes a bug in the pos-enc impl, which has little impact
            on the final performance. For now, we keep both impls for backward compatibility.
            We will remove the buggy impl after re-training all variants of our released models.

        
kornia/feature/loftr/utils/position_encoding.py