

'''simple docstring'''
from unittest import TestCase

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







class 							A__    (       A__  ):





  def 						A  (		self      :	Optional[Any] )	->    str:





       '''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 						A  (		self      :	Any )	->    Tuple:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    ={'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
       return Dataset.from_dict(_a )





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





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =self._create_example_records()
       _SCREAMING_SNAKE_CASE							    =Dataset.from_list(_a )
       self.assertListEqual(dset.column_names							,					['col_1', 'col_2'] )
       for i, r in enumerate(_a ):
            self.assertDictEqual(_a							,					example_records[i] )





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





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =self._create_example_records()
       _SCREAMING_SNAKE_CASE							    =Dataset.from_list(_a )
       _SCREAMING_SNAKE_CASE							    =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 						A  (		self      :	Any )	->    List[Any]:  # checks what happens with missing columns





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =[{'col_1': 1}, {'col_2': 'x'}]
       _SCREAMING_SNAKE_CASE							    =Dataset.from_list(_a )
       self.assertDictEqual(dset[0]							,					{'col_1': 1} )
       self.assertDictEqual(dset[1]							,					{'col_1': None} )  # NB: first record is used for columns





  def 						A  (		self      :	str )	->    int:  # checks if the type can be inferred from the second record





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =[{'col_1': []}, {'col_1': [1, 2]}]
       _SCREAMING_SNAKE_CASE							    =Dataset.from_list(_a )
       self.assertEqual(dset.info.features['col_1']							,					Sequence(Value('int64' ) ) )





  def 						A  (		self      :	Optional[Any] )	->    Tuple:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =Dataset.from_list([] )
       self.assertEqual(len(_a )							,					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


lowerCamelCase :      List[str]					 =     logging.get_logger(__name__)

lowerCamelCase :      List[Any]					 =     {
    "facebook/convnextv2-tiny-1k-224": "https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json",
}







class 							A__    (       A__     ,   A__  ):
  A__		 =				'convnextv2'





  def __init__(		self      :	Tuple							,					_a      :	Optional[int]=3							,					_a      :	Any=4							,					_a      :	int=4							,					_a      :	Union[str, Any]=None							,					_a      :	List[str]=None							,					_a      :	Optional[Any]="gelu"							,					_a      :	Any=0.02							,					_a      :	Any=1e-12							,					_a      :	Tuple=0.0							,					_a      :	int=224							,					_a      :	Any=None							,					_a      :	Optional[int]=None							,					**_a      :	List[str]							,					)	->    Optional[Any]:





       '''simple docstring'''






       super().__init__(**_a )

       _SCREAMING_SNAKE_CASE							    =num_channels
       _SCREAMING_SNAKE_CASE							    =patch_size
       _SCREAMING_SNAKE_CASE							    =num_stages
       _SCREAMING_SNAKE_CASE							    =[96, 192, 384, 768] if hidden_sizes is None else hidden_sizes
       _SCREAMING_SNAKE_CASE							    =[3, 3, 9, 3] if depths is None else depths
       _SCREAMING_SNAKE_CASE							    =hidden_act
       _SCREAMING_SNAKE_CASE							    =initializer_range
       _SCREAMING_SNAKE_CASE							    =layer_norm_eps
       _SCREAMING_SNAKE_CASE							    =drop_path_rate
       _SCREAMING_SNAKE_CASE							    =image_size
       _SCREAMING_SNAKE_CASE							    =['stem'] + [f"stage{idx}" for idx in range(1							,					len(self.depths ) + 1 )]
       _SCREAMING_SNAKE_CASE    ,						_SCREAMING_SNAKE_CASE							    =get_aligned_output_features_output_indices(
           out_features=_a							,					out_indices=_a							,					stage_names=self.stage_names )
