

'''simple docstring'''

from collections import OrderedDict
from typing import List, Mapping

from packaging import version

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


lowercase__         =      logging.get_logger(__name__)

lowercase__         =      {
    "google/efficientnet-b7": "https://huggingface.co/google/efficientnet-b7/resolve/main/config.json",
}




class 	A_				(    UpperCAmelCase__							):






     '''simple docstring'''



     UpperCAmelCase_						:     Union[str, Any]  		=  'efficientnet'


     def __init__(		self			:					Dict					,      lowercase_			:					List[Any] = 3					,      lowercase_			:					List[Any] = 600					,      lowercase_			:					Any = 2.0					,      lowercase_			:					List[Any] = 3.1					,      lowercase_			:					Tuple = 8					,      lowercase_			:					str = [3, 3, 5, 3, 5, 5, 3]					,      lowercase_			:					Optional[Any] = [32, 16, 24, 40, 80, 112, 192]					,      lowercase_			:					Dict = [16, 24, 40, 80, 112, 192, 320]					,      lowercase_			:					List[Any] = []					,      lowercase_			:					List[str] = [1, 2, 2, 2, 1, 2, 1]					,      lowercase_			:					Optional[Any] = [1, 2, 2, 3, 3, 4, 1]					,      lowercase_			:					List[str] = [1, 6, 6, 6, 6, 6, 6]					,      lowercase_			:					Dict = 0.25					,      lowercase_			:					Tuple = "swish"					,      lowercase_			:					Dict = 2_560					,      lowercase_			:					Optional[Any] = "mean"					,      lowercase_			:					str = 0.02					,      lowercase_			:					Union[str, Any] = 0.001					,      lowercase_			:					Optional[Any] = 0.99					,      lowercase_			:					int = 0.5					,      lowercase_			:					Union[str, Any] = 0.2					,      **lowercase_			:					Any					,      )						->     str:
      super().__init__(**_SCREAMING_SNAKE_CASE	)

      UpperCAmelCase	:     List[str]						 =			num_channels
      UpperCAmelCase	:     Union[str, Any]						 =			image_size
      UpperCAmelCase	:     int						 =			width_coefficient
      UpperCAmelCase	:     int						 =			depth_coefficient
      UpperCAmelCase	:     Optional[Any]						 =			depth_divisor
      UpperCAmelCase	:     Optional[int]						 =			kernel_sizes
      UpperCAmelCase	:     str						 =			in_channels
      UpperCAmelCase	:     Dict						 =			out_channels
      UpperCAmelCase	:     str						 =			depthwise_padding
      UpperCAmelCase	:     Tuple						 =			strides
      UpperCAmelCase	:     List[str]						 =			num_block_repeats
      UpperCAmelCase	:     Tuple						 =			expand_ratios
      UpperCAmelCase	:     int						 =			squeeze_expansion_ratio
      UpperCAmelCase	:     Tuple						 =			hidden_act
      UpperCAmelCase	:     Optional[int]						 =			hidden_dim
      UpperCAmelCase	:     int						 =			pooling_type
      UpperCAmelCase	:     Optional[Any]						 =			initializer_range
      UpperCAmelCase	:     int						 =			batch_norm_eps
      UpperCAmelCase	:     Any						 =			batch_norm_momentum
      UpperCAmelCase	:     List[Any]						 =			dropout_rate
      UpperCAmelCase	:     Optional[int]						 =			drop_connect_rate
      UpperCAmelCase	:     Optional[int]						 =			sum(_SCREAMING_SNAKE_CASE	) * 4




class 	A_				(    UpperCAmelCase__							):






     '''simple docstring'''



     UpperCAmelCase_						:     Dict  		=  version.parse("""1.11"""							)


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




     @property
     def        UpperCAmelCase_	(		self			:					List[Any]	)						->     float:
      return 1E-5







'''simple docstring'''

# Lint as: python3
import itertools
import os
import re


lowercase__         =      re.compile(r"([A-Z]+)([A-Z][a-z])")
lowercase__         =      re.compile(r"([a-z\d])([A-Z])")

lowercase__         =      re.compile(r"(?<!_)_(?!_)")
lowercase__         =      re.compile(r"(_{2,})")

lowercase__         =      r"^\w+(\.\w+)*$"

lowercase__         =      r"<>:/\|?*"




def 				UpperCamelCase(					UpperCAmelCase_     ):
 UpperCAmelCase	:     List[str]						 =			_uppercase_uppercase_re.sub(R'\1_\2'  ,	UpperCAmelCase_     )
 UpperCAmelCase	:     str						 =			_lowercase_uppercase_re.sub(R'\1_\2'  ,	UpperCAmelCase_     )
 return name.lower()




def 				UpperCamelCase(					UpperCAmelCase_     ):
 UpperCAmelCase	:     List[str]						 =			_single_underscore_re.split(UpperCAmelCase_     )
 UpperCAmelCase	:     Optional[Any]						 =			[_multiple_underscores_re.split(UpperCAmelCase_     ) for n in name]
 return "".join(n.capitalize() for n in itertools.chain.from_iterable(UpperCAmelCase_     ) if n != ''     )




def 				UpperCamelCase(					UpperCAmelCase_     ):
 if os.path.basename(UpperCAmelCase_     ) != name:
  raise ValueError(F"""Should be a dataset name, not a path: {name}"""     )
 return camelcase_to_snakecase(UpperCAmelCase_     )




def 				UpperCamelCase(					UpperCAmelCase_  ,	UpperCAmelCase_     ):
 if os.path.basename(UpperCAmelCase_     ) != name:
  raise ValueError(F"""Should be a dataset name, not a path: {name}"""     )
 if not re.match(_split_re  ,	UpperCAmelCase_     ):
  raise ValueError(F"""Split name should match '{_split_re}'' but got '{split}'."""     )
 return F"""{filename_prefix_for_name(UpperCAmelCase_     )}-{split}"""




def 				UpperCamelCase(					UpperCAmelCase_  ,	UpperCAmelCase_  ,	UpperCAmelCase_  ,	UpperCAmelCase_=None     ):
 UpperCAmelCase	:     Dict						 =			filename_prefix_for_split(UpperCAmelCase_  ,	UpperCAmelCase_     )
 if filetype_suffix:
  prefix += F""".{filetype_suffix}"""
 UpperCAmelCase	:     Optional[int]						 =			os.path.join(UpperCAmelCase_  ,	UpperCAmelCase_     )
 return F"""{filepath}*"""




def 				UpperCamelCase(					UpperCAmelCase_  ,	UpperCAmelCase_  ,	UpperCAmelCase_  ,	UpperCAmelCase_=None  ,	UpperCAmelCase_=None     ):
 UpperCAmelCase	:     Optional[int]						 =			filename_prefix_for_split(UpperCAmelCase_  ,	UpperCAmelCase_     )
 UpperCAmelCase	:     str						 =			os.path.join(UpperCAmelCase_  ,	UpperCAmelCase_     )

 if shard_lengths:
  UpperCAmelCase	:     List[str]						 =			len(UpperCAmelCase_     )
  UpperCAmelCase	:     List[str]						 =			[F"""{prefix}-{shard_id:05d}-of-{num_shards:05d}""" for shard_id in range(UpperCAmelCase_     )]
  if filetype_suffix:
   UpperCAmelCase	:     Dict						 =			[filename + F""".{filetype_suffix}""" for filename in filenames]
  return filenames
 else:
  UpperCAmelCase	:     Optional[Any]						 =			prefix
  if filetype_suffix:
   filename += F""".{filetype_suffix}"""
  return [filename]




