
'''simple docstring'''
import warnings
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__						       =      logging.get_logger(__name__)

lowercase__						       =      {
    "nvidia/segformer-b0-finetuned-ade-512-512": (
        "https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512/resolve/main/config.json"
    ),
    # See all SegFormer models at https://huggingface.co/models?filter=segformer
}






class 	snake_case__       (      __SCREAMING_SNAKE_CASE					):







		"""simple docstring"""

		lowerCamelCase     							=						"""segformer"""



		def __init__(      self				:			str  ,	UpperCamelCase__				:			Any=3  ,	UpperCamelCase__				:			Optional[Any]=4  ,	UpperCamelCase__				:			str=[2, 2, 2, 2]  ,	UpperCamelCase__				:			Optional[Any]=[8, 4, 2, 1]  ,	UpperCamelCase__				:			Optional[Any]=[32, 64, 160, 256]  ,	UpperCamelCase__				:			int=[7, 3, 3, 3]  ,	UpperCamelCase__				:			Optional[int]=[4, 2, 2, 2]  ,	UpperCamelCase__				:			Any=[1, 2, 5, 8]  ,	UpperCamelCase__				:			Dict=[4, 4, 4, 4]  ,	UpperCamelCase__				:			Any="gelu"  ,	UpperCamelCase__				:			Any=0.0  ,	UpperCamelCase__				:			List[Any]=0.0  ,	UpperCamelCase__				:			List[Any]=0.1  ,	UpperCamelCase__				:			Optional[int]=0.02  ,	UpperCamelCase__				:			Union[str, Any]=0.1  ,	UpperCamelCase__				:			str=1e-6  ,	UpperCamelCase__				:			Optional[int]=256  ,	UpperCamelCase__				:			Optional[int]=255  ,	**UpperCamelCase__				:			Tuple  ,	)						->			str:






				"""simple docstring"""







				super().__init__(**UpperCamelCase__      )

				if "reshape_last_stage" in kwargs and kwargs["reshape_last_stage"] is False:
						warnings.warn(
						    '''Reshape_last_stage is set to False in this config. This argument is deprecated and will soon be'''
						    ''' removed, as the behaviour will default to that of reshape_last_stage = True.'''  ,	UpperCamelCase__  ,	)

				snake_case  :       Optional[int]     			=						num_channels
				snake_case  :       Any     			=						num_encoder_blocks
				snake_case  :       List[Any]     			=						depths
				snake_case  :       List[Any]     			=						sr_ratios
				snake_case  :       Dict     			=						hidden_sizes
				snake_case  :       int     			=						patch_sizes
				snake_case  :       List[str]     			=						strides
				snake_case  :       Dict     			=						mlp_ratios
				snake_case  :       Dict     			=						num_attention_heads
				snake_case  :       int     			=						hidden_act
				snake_case  :       Tuple     			=						hidden_dropout_prob
				snake_case  :       List[str]     			=						attention_probs_dropout_prob
				snake_case  :       List[str]     			=						classifier_dropout_prob
				snake_case  :       List[Any]     			=						initializer_range
				snake_case  :       Dict     			=						drop_path_rate
				snake_case  :       Optional[Any]     			=						layer_norm_eps
				snake_case  :       List[str]     			=						decoder_hidden_size
				snake_case  :       Optional[Any]     			=						kwargs.get('''reshape_last_stage'''  ,	UpperCamelCase__      )
				snake_case  :       List[str]     			=						semantic_loss_ignore_index







class 	snake_case__       (      __SCREAMING_SNAKE_CASE					):







		"""simple docstring"""

		lowerCamelCase     							=						version.parse("""1.11"""					)



		@property
		def       lowerCAmelCase				(      self				:			Dict      )						->			Mapping[str, Mapping[int, str]]:






				"""simple docstring"""







				return OrderedDict(
				    [
				        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
				    ]      )



		@property
		def       lowerCAmelCase				(      self				:			List[Any]      )						->			float:






				"""simple docstring"""







				return 1e-4



		@property
		def       lowerCAmelCase				(      self				:			str      )						->			int:






				"""simple docstring"""







				return 12




'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


lowercase__						       =      {
    "configuration_poolformer": [
        "POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "PoolFormerConfig",
        "PoolFormerOnnxConfig",
    ]
}

try:
						if not is_vision_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowercase__						       =      ["PoolFormerFeatureExtractor"]
						lowercase__						       =      ["PoolFormerImageProcessor"]

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowercase__						       =      [
						    "POOLFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "PoolFormerForImageClassification",
						    "PoolFormerModel",
						    "PoolFormerPreTrainedModel",
						]


if TYPE_CHECKING:
						from .configuration_poolformer import (
						    POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    PoolFormerConfig,
						    PoolFormerOnnxConfig,
						)

						try:
												if not is_vision_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .feature_extraction_poolformer import PoolFormerFeatureExtractor
												from .image_processing_poolformer import PoolFormerImageProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_poolformer import (
												    POOLFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    PoolFormerForImageClassification,
												    PoolFormerModel,
												    PoolFormerPreTrainedModel,
												)


else:
						import sys

						lowercase__						       =      _LazyModule(__name__, globals()["__file__"], _import_structure)


