





'''simple docstring'''




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


_A:					Dict							=				logging.get_logger(__name__)






class UpperCAmelCase							(		UpperCAmelCase_					,			UpperCAmelCase_							):
    _A :			Tuple						   =       """maskformer-swin"""

    _A :			Union[str, Any]						   =       {
        """num_attention_heads""": """num_heads""",
        """num_hidden_layers""": """num_layers""",
    }



    def __init__(  self     ,			__A=224     ,			__A=4     ,			__A=3     ,			__A=96     ,			__A=[2, 2, 6, 2]     ,			__A=[3, 6, 12, 24]     ,			__A=7     ,			__A=4.0     ,			__A=True     ,			__A=0.0     ,			__A=0.0     ,			__A=0.1     ,			__A="gelu"     ,			__A=False     ,			__A=0.0_2     ,			__A=1E-5     ,			__A=None     ,			__A=None     ,			**__A     ,			):
     super().__init__(**__A					)

     __UpperCAmelCase					=   image_size
     __UpperCAmelCase					=   patch_size
     __UpperCAmelCase					=   num_channels
     __UpperCAmelCase					=   embed_dim
     __UpperCAmelCase					=   depths
     __UpperCAmelCase					=   len(__A					)
     __UpperCAmelCase					=   num_heads
     __UpperCAmelCase					=   window_size
     __UpperCAmelCase					=   mlp_ratio
     __UpperCAmelCase					=   qkv_bias
     __UpperCAmelCase					=   hidden_dropout_prob
     __UpperCAmelCase					=   attention_probs_dropout_prob
     __UpperCAmelCase					=   drop_path_rate
     __UpperCAmelCase					=   hidden_act
     __UpperCAmelCase					=   use_absolute_embeddings
     __UpperCAmelCase					=   layer_norm_eps
     __UpperCAmelCase					=   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
     __UpperCAmelCase					=   int(embed_dim * 2 ** (len(__A					) - 1)					)
     __UpperCAmelCase					=   ['stem'] + [f'stage{idx}' for idx in range(1     ,			len(__A					) + 1					)]
     __UpperCAmelCase					,    __UpperCAmelCase					=   get_aligned_output_features_output_indices(
         out_features=__A     ,			out_indices=__A     ,			stage_names=self.stage_names					)












'''simple docstring'''




from __future__ import annotations







def _lowerCAmelCase     (      _lowerCAmelCase    )->     int:
 if not nums:
  return 0
 __UpperCAmelCase					=   nums[0]
 __UpperCAmelCase					=   0
 for num in nums[1:]:
  __UpperCAmelCase					,    __UpperCAmelCase					=   (
      max_excluding + num,
      max(_lowerCAmelCase       ,    _lowerCAmelCase    ),
  )
 return max(_lowerCAmelCase       ,    _lowerCAmelCase    )


if __name__ == "__main__":
    import doctest

    doctest.testmod()





