






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


__UpperCamelCase   :   Dict      =    logging.get_logger(__name__)


class 							__UpperCamelCase     (  _lowerCAmelCase ,      _lowerCAmelCase ):
	__snake_case						:Optional[Any] =							'maskformer-swin'

	__snake_case						:Dict =							{
	    'num_attention_heads': 'num_heads',
	    'num_hidden_layers': 'num_layers',
	}







	def __init__(	self   :				Optional[Any]							,					_lowerCAmelCase   :				Optional[Any]=224							,					_lowerCAmelCase   :				int=4							,					_lowerCAmelCase   :				Any=3							,					_lowerCAmelCase   :				List[Any]=96							,					_lowerCAmelCase   :				List[str]=[2, 2, 6, 2]							,					_lowerCAmelCase   :				List[str]=[3, 6, 12, 24]							,					_lowerCAmelCase   :				Any=7							,					_lowerCAmelCase   :				Optional[int]=4.0							,					_lowerCAmelCase   :				str=True							,					_lowerCAmelCase   :				Optional[Any]=0.0							,					_lowerCAmelCase   :				List[str]=0.0							,					_lowerCAmelCase   :				Optional[int]=0.1							,					_lowerCAmelCase   :				Optional[Any]="gelu"							,					_lowerCAmelCase   :				str=False							,					_lowerCAmelCase   :				Union[str, Any]=0.02							,					_lowerCAmelCase   :				str=1e-5							,					_lowerCAmelCase   :				Union[str, Any]=None							,					_lowerCAmelCase   :				Optional[int]=None							,					**_lowerCAmelCase   :				List[str]							,					)		->			Tuple:
		"""simple docstring"""







		super().__init__(**_lowerCAmelCase      )

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








'''simple docstring'''




from collections import Counter
from timeit import timeit




def 						__lowerCamelCase			(	UpperCAmelCase_ = ""					,				)   ->bool:
	return sum(c % 2 for c in Counter(input_str.replace(' '					,				''							).lower()							).values()							) < 2




def 						__lowerCamelCase			(	UpperCAmelCase_ = ""							)   ->bool:
	if len(UpperCAmelCase_							) == 0:
		return True
	snake_case__	       =   input_str.replace(' '					,				''							).lower()
	# character_freq_dict: Stores the frequency of every character in the input string
	snake_case__	       =   {}

	for character in lower_case_input_str:
		snake_case__	       =   character_freq_dict.get(UpperCAmelCase_					,				0							) + 1
	snake_case__	       =   0

	for character_count in character_freq_dict.values():
		if character_count % 2:
			odd_char += 1
	if odd_char > 1:
		return False
	return True




def 						__lowerCamelCase			(	UpperCAmelCase_ = ""							)   ->None:
	print('\nFor string = '					,				UpperCAmelCase_					,				':'							)
	print(
	    '> can_string_be_rearranged_as_palindrome_counter()'					,				'\tans ='					,				can_string_be_rearranged_as_palindrome_counter(UpperCAmelCase_							)					,				'\ttime ='					,				timeit(
	        'z.can_string_be_rearranged_as_palindrome_counter(z.check_str)'					,				setup='import __main__ as z'					,				)					,				'seconds'					,				)
	print(
	    '> can_string_be_rearranged_as_palindrome()'					,				'\tans ='					,				can_string_be_rearranged_as_palindrome(UpperCAmelCase_							)					,				'\ttime ='					,				timeit(
	        'z.can_string_be_rearranged_as_palindrome(z.check_str)'					,				setup='import __main__ as z'					,				)					,				'seconds'					,				)


if __name__ == "__main__":
			a__					:			str          =     input(
			    '''Enter string to determine if it can be rearranged as a palindrome or not: '''
			).strip()
			benchmark(check_str)
			a__					:			List[Any]          =     can_string_be_rearranged_as_palindrome_counter(check_str)
			print(f"""{check_str} can {'' if status else 'not '}be rearranged as a palindrome""")



