from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowercase__      :    Union[str, Any]          =     logging.get_logger(__name__)

lowercase__      :    Tuple          =     {
    '''MBZUAI/swiftformer-xs''': '''https://huggingface.co/MBZUAI/swiftformer-xs/resolve/main/config.json''',
}




class        lowercase_  (  UpperCamelCase_						):



	"""simple docstring"""





	UpperCAmelCase_  : Dict       =    """swiftformer"""


	def __init__(							self		,      __SCREAMING_SNAKE_CASE=3		,      __SCREAMING_SNAKE_CASE=[3, 3, 6, 4]		,      __SCREAMING_SNAKE_CASE=[48, 56, 112, 220]		,      __SCREAMING_SNAKE_CASE=4		,      __SCREAMING_SNAKE_CASE=[True, True, True, True]		,      __SCREAMING_SNAKE_CASE="gelu"		,      __SCREAMING_SNAKE_CASE=3		,      __SCREAMING_SNAKE_CASE=2		,      __SCREAMING_SNAKE_CASE=1		,      __SCREAMING_SNAKE_CASE=0.0		,      __SCREAMING_SNAKE_CASE=True		,      __SCREAMING_SNAKE_CASE=1e-5		,      __SCREAMING_SNAKE_CASE=1e-5		,      **__SCREAMING_SNAKE_CASE		,      )						->List[str]:
								super().__init__(**__SCREAMING_SNAKE_CASE    )
								lowerCAmelCase     		=		num_channels
								lowerCAmelCase     		=		depths
								lowerCAmelCase     		=		embed_dims
								lowerCAmelCase     		=		mlp_ratio
								lowerCAmelCase     		=		downsamples
								lowerCAmelCase     		=		hidden_act
								lowerCAmelCase     		=		down_patch_size
								lowerCAmelCase     		=		down_stride
								lowerCAmelCase     		=		down_pad
								lowerCAmelCase     		=		drop_path_rate
								lowerCAmelCase     		=		use_layer_scale
								lowerCAmelCase     		=		layer_scale_init_value
								lowerCAmelCase     		=		batch_norm_eps




class        lowercase_  (  UpperCamelCase_						):



	"""simple docstring"""





	UpperCAmelCase_  : List[Any]       =    version.parse("""1.11"""						)


	@property
	def       SCREAMING_SNAKE_CASE_    (							self    )						->Mapping[str, Mapping[int, str]]:
								return OrderedDict(
								    [
								        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
								    ]    )




	@property
	def       SCREAMING_SNAKE_CASE_    (							self    )						->float:
								return 1e-4




from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier

# Load iris file
lowercase__      :    int          =     load_iris()
iris.keys()


print(f'Target names: \n {iris.target_names} ')
print(f'\n Features: \n {iris.feature_names}')

# Train set e Test set
lowercase__     ,   lowercase__     ,   lowercase__     ,   lowercase__      :    Any          =     train_test_split(
    iris['''data'''], iris['''target'''], random_state=4
)

# KNN

lowercase__      :    int          =     KNeighborsClassifier(n_neighbors=1)
knn.fit(X_train, y_train)

# new array to test
lowercase__      :    List[str]          =     [[1, 2, 1, 4], [2, 3, 4, 5]]

lowercase__      :    int          =     knn.predict(X_new)

print(
    f'\nNew array: \n {X_new}\n\nTarget Names Prediction: \n'
    f' {iris["target_names"][prediction]}'
)



