
"""simple docstring"""





from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset



class __lowerCAmelCase				(					lowercase_      ):




   """simple docstring"""







   def      lowerCamelCase__     (				self						:					Union[str, Any]	)      -> Any:







        """simple docstring"""
        return [
            {"col_1": 3, "col_2": "a"},
            {"col_1": 2, "col_2": "b"},
            {"col_1": 1, "col_2": "c"},
            {"col_1": 0, "col_2": "d"},
        ]




   def      lowerCamelCase__     (				self						:					Union[str, Any]	)      -> Tuple:







        """simple docstring"""
        A_				 =						{"col_1": [3, 2, 1, 0], "col_2": ["a", "b", "c", "d"]}
        return Dataset.from_dict(_snake_case	)




   def      lowerCamelCase__     (				self						:					List[str]	)      -> int:







        """simple docstring"""
        A_				 =						self._create_example_records()
        A_				 =						Dataset.from_list(_snake_case	)
        self.assertListEqual(dset.column_names       ,   ["col_1", "col_2"]	)
        for i, r in enumerate(_snake_case	):
             self.assertDictEqual(_snake_case       ,   example_records[i]	)




   def      lowerCamelCase__     (				self						:					List[Any]	)      -> str:







        """simple docstring"""
        A_				 =						self._create_example_records()
        A_				 =						Dataset.from_list(_snake_case	)
        A_				 =						Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]}	)
        self.assertEqual(dset.info       ,   dset_from_dict.info	)




   def      lowerCamelCase__     (				self						:					Dict	)      -> Dict:  # checks what happens with missing columns







        """simple docstring"""
        A_				 =						[{"col_1": 1}, {"col_2": "x"}]
        A_				 =						Dataset.from_list(_snake_case	)
        self.assertDictEqual(dset[0]       ,   {"col_1": 1}	)
        self.assertDictEqual(dset[1]       ,   {"col_1": None}	)  # NB: first record is used for columns




   def      lowerCamelCase__     (				self						:					Optional[int]	)      -> Dict:  # checks if the type can be inferred from the second record







        """simple docstring"""
        A_				 =						[{"col_1": []}, {"col_1": [1, 2]}]
        A_				 =						Dataset.from_list(_snake_case	)
        self.assertEqual(dset.info.features["col_1"]       ,   Sequence(Value("int64"	)	)	)






   def      lowerCamelCase__     (				self						:					int	)      -> Optional[Any]:







        """simple docstring"""
        A_				 =						Dataset.from_list([]	)
        self.assertEqual(len(_snake_case	)       ,   0	)
        self.assertListEqual(dset.column_names       ,   []	)






"""simple docstring"""





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


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

UpperCamelCase_					:						Dict				= {
    '''microsoft/focalnet-tiny''': '''https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json''',
}



class __lowerCAmelCase				(					_lowercase     ,				_lowercase      ):




			"""simple docstring"""







			snake_case	      =				"focalnet"




			def __init__(				self						:					Any       ,   _snake_case						:					Optional[int]=224       ,   _snake_case						:					List[str]=4       ,   _snake_case						:					Any=3       ,   _snake_case						:					List[Any]=96       ,   _snake_case						:					Union[str, Any]=False       ,   _snake_case						:					Optional[Any]=[192, 384, 768, 768]       ,   _snake_case						:					List[str]=[2, 2, 6, 2]       ,   _snake_case						:					Any=[2, 2, 2, 2]       ,   _snake_case						:					List[Any]=[3, 3, 3, 3]       ,   _snake_case						:					Optional[Any]="gelu"       ,   _snake_case						:					Dict=4.0       ,   _snake_case						:					List[Any]=0.0       ,   _snake_case						:					List[str]=0.1       ,   _snake_case						:					Optional[Any]=False       ,   _snake_case						:					Any=1e-4       ,   _snake_case						:					str=False       ,   _snake_case						:					Optional[int]=False       ,   _snake_case						:					Tuple=False       ,   _snake_case						:					Any=0.0_2       ,   _snake_case						:					List[Any]=1e-5       ,   _snake_case						:					Union[str, Any]=32       ,   _snake_case						:					Tuple=None       ,   _snake_case						:					Any=None       ,   **_snake_case						:					Tuple       ,   )      -> str:







								"""simple docstring"""
								super().__init__(**_snake_case	)

								A_				 =						image_size
								A_				 =						patch_size
								A_				 =						num_channels
								A_				 =						embed_dim
								A_				 =						use_conv_embed
								A_				 =						hidden_sizes
								A_				 =						depths
								A_				 =						focal_levels
								A_				 =						focal_windows
								A_				 =						hidden_act
								A_				 =						mlp_ratio
								A_				 =						hidden_dropout_prob
								A_				 =						drop_path_rate
								A_				 =						use_layerscale
								A_				 =						layerscale_value
								A_				 =						use_post_layernorm
								A_				 =						use_post_layernorm_in_modulation
								A_				 =						normalize_modulator
								A_				 =						initializer_range
								A_				 =						layer_norm_eps
								A_				 =						encoder_stride
								A_				 =						["stem"] + [F'stage{idx}' for idx in range(1       ,   len(self.depths	) + 1	)]
								A_ ,    A_				 =						get_aligned_output_features_output_indices(
								    out_features=_snake_case       ,   out_indices=_snake_case       ,   stage_names=self.stage_names	)




