



'''simple docstring'''





import numpy as np



def    snake_case_				(    _SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE   ):
	__lowercase		       =			int(np.ceil((x_end - xa) / h   )   )
	__lowercase		       =			np.zeros((n + 1,)   )
	__lowercase		       =			ya
	__lowercase		       =			xa

	for k in range(snake_case__   ):
		__lowercase		       =			f(snake_case__  ,	y[k]   )
		__lowercase		       =			f(x + 0.5 * h  ,	y[k] + 0.5 * h * ka   )
		__lowercase		       =			f(x + 0.5 * h  ,	y[k] + 0.5 * h * ka   )
		__lowercase		       =			f(x + h  ,	y[k] + h * ka   )
		__lowercase		       =			y[k] + (1 / 6) * h * (ka + 2 * ka + 2 * ka + ka)
		x += h

	return y


if __name__ == "__main__":
	import doctest

	doctest.testmod()








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


snake_case__					:     Any    		=   logging.get_logger(__name__)

class   _A   ( _lowercase  ,						_lowercase	):


						'''simple docstring'''





						_snake_case			:     Dict      							=      """maskformer-swin"""

						_snake_case			:     List[str]      							=      {
						    """num_attention_heads""": """num_heads""",
						    """num_hidden_layers""": """num_layers""",
						}



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






							'''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	)



