




from __future__ import annotations







def 		lowercase__   (		__A:	list[list[int]]				):





					'''simple docstring'''






					__magic_name__							:	Union[str, Any]    							=							len(__A				)
					# We need to create solution object to save path.
					__magic_name__							:	List[Any]    							=							[[0 for _ in range(__A				)] for _ in range(__A				)]
					__magic_name__							:	Any    							=							run_maze(__A							,0							,0							,__A				)
					if solved:
										print('''\n'''.join(str(__A				) for row in solutions				)				)
					else:
										print('''No solution exists!'''				)
					return solved







def 		lowercase__   (		__A:	list[list[int]]							,__A:	int							,__A:	int							,__A:	list[list[int]]				):





					'''simple docstring'''






					__magic_name__							:	List[Any]    							=							len(__A				)
					# Final check point.
					if i == j == (size - 1):
										__magic_name__							:	List[Any]    							=							1
										return True

					__magic_name__							:	Dict    							=							(not i < 0) and (not j < 0)  # Check lower bounds
					__magic_name__							:	Union[str, Any]    							=							(i < size) and (j < size)  # Check upper bounds

					if lower_flag and upper_flag:
										# check for already visited and block points.
										__magic_name__							:	Optional[int]    							=							(not solutions[i][j]) and (not maze[i][j])
										if block_flag:
															# check visited
															__magic_name__							:	Tuple    							=							1

															# check for directions
															if (
															    run_maze(__A							,i + 1							,__A							,__A				)
															    or run_maze(__A							,__A							,j + 1							,__A				)
															    or run_maze(__A							,i - 1							,__A							,__A				)
															    or run_maze(__A							,__A							,j - 1							,__A				)
															):
																				return True

															__magic_name__							:	Union[str, Any]    							=							0
															return False
					return False


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


__lowerCamelCase   :						Optional[int]				=			logging.get_logger(__name__)

__lowerCamelCase   :						Tuple				=			{
    '''shi-labs/nat-mini-in1k-224''': '''https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json''',
    # See all Nat models at https://huggingface.co/models?filter=nat
}


class    lowerCamelCase    (		_lowerCamelCase				,_lowerCamelCase						):






			'''simple docstring'''





			UpperCamelCase__								='''nat'''

			UpperCamelCase__								={
			    '''num_attention_heads''': '''num_heads''',
			    '''num_hidden_layers''': '''num_layers''',
			}

			def __init__( self			:   Union[str, Any]       ,						lowerCamelCase_			:   Dict=4       ,						lowerCamelCase_			:   Union[str, Any]=3       ,						lowerCamelCase_			:   List[str]=64       ,						lowerCamelCase_			:   Union[str, Any]=[3, 4, 6, 5]       ,						lowerCamelCase_			:   List[Any]=[2, 4, 8, 16]       ,						lowerCamelCase_			:   List[Any]=7       ,						lowerCamelCase_			:   Union[str, Any]=3.0       ,						lowerCamelCase_			:   int=True       ,						lowerCamelCase_			:   str=0.0       ,						lowerCamelCase_			:   int=0.0       ,						lowerCamelCase_			:   Dict=0.1       ,						lowerCamelCase_			:   Optional[int]="gelu"       ,						lowerCamelCase_			:   Tuple=0.0_2       ,						lowerCamelCase_			:   Tuple=1E-5       ,						lowerCamelCase_			:   List[Any]=0.0       ,						lowerCamelCase_			:   str=None       ,						lowerCamelCase_			:   Tuple=None       ,						**lowerCamelCase_			:   Any       ,						)						->   Any:
								super().__init__(**lowerCamelCase_  )

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



