


from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__lowerCamelCase        =     logging.get_logger(__name__)


class   a__	(						lowerCAmelCase_						,       lowerCAmelCase_    ):
       lowerCamelCase__:     Optional[Any]							    =     """maskformer-swin"""

       lowerCamelCase__:     List[Any]							    =     {
           """num_attention_heads""": """num_heads""",
           """num_hidden_layers""": """num_layers""",
       }

       def __init__(   self      :     List[Any]      ,							lowerCamelCase_      :     List[Any]=2_2_4      ,							lowerCamelCase_      :     Optional[int]=4      ,							lowerCamelCase_      :     List[Any]=3      ,							lowerCamelCase_      :     Optional[Any]=9_6      ,							lowerCamelCase_      :     List[str]=[2, 2, 6, 2]      ,							lowerCamelCase_      :     str=[3, 6, 1_2, 2_4]      ,							lowerCamelCase_      :     str=7      ,							lowerCamelCase_      :     List[Any]=4.0      ,							lowerCamelCase_      :     Optional[Any]=True      ,							lowerCamelCase_      :     Any=0.0      ,							lowerCamelCase_      :     Dict=0.0      ,							lowerCamelCase_      :     Optional[Any]=0.1      ,							lowerCamelCase_      :     Optional[Any]="gelu"      ,							lowerCamelCase_      :     str=False      ,							lowerCamelCase_      :     List[str]=0.0_2      ,							lowerCamelCase_      :     str=1E-5      ,							lowerCamelCase_      :     Union[str, Any]=None      ,							lowerCamelCase_      :     Optional[int]=None      ,							**lowerCamelCase_      :     Dict      ,							):
            super().__init__(**lowerCamelCase_    )

            a_    :     Any										=    image_size
            a_    :     Tuple										=    patch_size
            a_    :     Union[str, Any]										=    num_channels
            a_    :     Optional[Any]										=    embed_dim
            a_    :     int										=    depths
            a_    :     Any										=    len(lowerCamelCase_    )
            a_    :     List[Any]										=    num_heads
            a_    :     Dict										=    window_size
            a_    :     Optional[int]										=    mlp_ratio
            a_    :     Any										=    qkv_bias
            a_    :     Optional[Any]										=    hidden_dropout_prob
            a_    :     int										=    attention_probs_dropout_prob
            a_    :     List[Any]										=    drop_path_rate
            a_    :     Tuple										=    hidden_act
            a_    :     str										=    use_absolute_embeddings
            a_    :     Any										=    layer_norm_eps
            a_    :     str										=    initializer_range
            # we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
            # this indicates the channel dimension after the last stage of the model
            a_    :     int										=    int(embed_dim * 2 ** (len(lowerCamelCase_    ) - 1)    )
            a_    :     str										=    ["""stem"""] + [F'''stage{idx}''' for idx in range(1      ,							len(lowerCamelCase_    ) + 1    )]
            a_			,			a_    :     Any										=    get_aligned_output_features_output_indices(
                out_features=lowerCamelCase_      ,							out_indices=lowerCamelCase_      ,							stage_names=self.stage_names    )







from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt



def  _a			(						__UpperCamelCase ):
     a_    :     int										=    int(number**0.5 )
     return number == sq * sq



def  _a			(						__UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase ):
     a_    :     int										=    x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
     a_    :     int										=    x_den * y_den * z_den
     a_    :     int										=    gcd(__UpperCamelCase  ,  __UpperCamelCase )
     top //= hcf
     bottom //= hcf
     return top, bottom



def  _a			(						__UpperCamelCase = 3_5 ):
     a_    :     set										=    set()
     a_    :     int
     a_    :     Fraction										=    Fraction(0 )
     a_    :     tuple[int, int]

     for x_num in range(1  ,  order + 1 ):
          for x_den in range(x_num + 1  ,  order + 1 ):
               for y_num in range(1  ,  order + 1 ):
                    for y_den in range(y_num + 1  ,  order + 1 ):
                         # n=1
                         a_    :     int										=    x_num * y_den + x_den * y_num
                         a_    :     Optional[int]										=    x_den * y_den
                         a_    :     Optional[Any]										=    gcd(__UpperCamelCase  ,  __UpperCamelCase )
                         z_num //= hcf
                         z_den //= hcf
                         if 0 < z_num < z_den <= order:
                              a_    :     Optional[int]										=    add_three(
                                  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase )
                              unique_s.add(__UpperCamelCase )

                         # n=2
                         a_    :     List[Any]										=    (
                             x_num * x_num * y_den * y_den + x_den * x_den * y_num * y_num
                         )
                         a_    :     str										=    x_den * x_den * y_den * y_den
                         if is_sq(__UpperCamelCase ) and is_sq(__UpperCamelCase ):
                              a_    :     Optional[Any]										=    int(sqrt(__UpperCamelCase ) )
                              a_    :     Optional[int]										=    int(sqrt(__UpperCamelCase ) )
                              a_    :     Optional[Any]										=    gcd(__UpperCamelCase  ,  __UpperCamelCase )
                              z_num //= hcf
                              z_den //= hcf
                              if 0 < z_num < z_den <= order:
                                   a_    :     str										=    add_three(
                                       __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase )
                                   unique_s.add(__UpperCamelCase )

                    # n=-1
                         a_    :     Union[str, Any]										=    x_num * y_num
                         a_    :     Tuple										=    x_den * y_num + x_num * y_den
                         a_    :     List[Any]										=    gcd(__UpperCamelCase  ,  __UpperCamelCase )
                         z_num //= hcf
                         z_den //= hcf
                         if 0 < z_num < z_den <= order:
                              a_    :     Union[str, Any]										=    add_three(
                                  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase )
                              unique_s.add(__UpperCamelCase )

                         # n=2
                         a_    :     Union[str, Any]										=    x_num * x_num * y_num * y_num
                         a_    :     Dict										=    (
                             x_den * x_den * y_num * y_num + x_num * x_num * y_den * y_den
                         )
                         if is_sq(__UpperCamelCase ) and is_sq(__UpperCamelCase ):
                              a_    :     Dict										=    int(sqrt(__UpperCamelCase ) )
                              a_    :     Union[str, Any]										=    int(sqrt(__UpperCamelCase ) )
                              a_    :     Dict										=    gcd(__UpperCamelCase  ,  __UpperCamelCase )
                              z_num //= hcf
                              z_den //= hcf
                              if 0 < z_num < z_den <= order:
                                   a_    :     List[Any]										=    add_three(
                                       __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase  ,  __UpperCamelCase )
                                   unique_s.add(__UpperCamelCase )

     for num, den in unique_s:
          total += Fraction(__UpperCamelCase  ,  __UpperCamelCase )

     return total.denominator + total.numerator


if __name__ == "__main__":
       print(f'''{solution() = }''')



