





from importlib import import_module

from .logging import get_logger


__UpperCamelCase:	Optional[int] = get_logger(__name__)


class       __lowerCAmelCase					:


	'''simple docstring'''





	def __init__(						self:						List[Any],					lowerCamelCase_:						Optional[int],					lowerCamelCase_:						Optional[Any]=None			):
			lowercase__					:      Any      =		attrs or []
			if module is not None:
					for key in module.__dict__:
							if key in attrs or not key.startswith('__'			):
									setattr(self,					lowerCamelCase_,					getattr(lowerCamelCase_,					lowerCamelCase_			)			)
			lowercase__					:      int      =		module._original_module if isinstance(lowerCamelCase_,					_PatchedModuleObj			) else module


class       __lowerCAmelCase					:


	'''simple docstring'''





	_A													=				[]

	def __init__(						self:						Union[str, Any],					lowerCamelCase_:						Optional[Any],					lowerCamelCase_:						str,					lowerCamelCase_:						Optional[int],					lowerCamelCase_:						Union[str, Any]=None			):
			lowercase__					:      str      =		obj
			lowercase__					:      Union[str, Any]      =		target
			lowercase__					:      Optional[Any]      =		new
			lowercase__					:      Optional[int]      =		target.split('.'			)[0]
			lowercase__					:      str      =		{}
			lowercase__					:      str      =		attrs or []

	def __enter__(						self:						str			):
			*lowercase__   ,				lowercase__					:      str      =		self.target.split('.'			)

			# Patch modules:
			# it's used to patch attributes of submodules like "os.path.join";
			# in this case we need to patch "os" and "os.path"

			for i in range(len(lowerCamelCase_			)			):
					try:
							lowercase__					:      Optional[int]      =		import_module('.'.join(submodules[: i + 1]			)			)
					except ModuleNotFoundError:
							continue
					# We iterate over all the globals in self.obj in case we find "os" or "os.path"
					for attr in self.obj.__dir__():
							lowercase__					:      str      =		getattr(self.obj,					lowerCamelCase_			)
							# We don't check for the name of the global, but rather if its value *is* "os" or "os.path".
							# This allows to patch renamed modules like "from os import path as ospath".
							if obj_attr is submodule or (
							    (isinstance(lowerCamelCase_,					_PatchedModuleObj			) and obj_attr._original_module is submodule)
							):
									lowercase__					:      Optional[Any]      =		obj_attr
									# patch at top level
									setattr(self.obj,					lowerCamelCase_,					_PatchedModuleObj(lowerCamelCase_,					attrs=self.attrs			)			)
									lowercase__					:      Optional[int]      =		getattr(self.obj,					lowerCamelCase_			)
									# construct lower levels patches
									for key in submodules[i + 1 :]:
											setattr(lowerCamelCase_,					lowerCamelCase_,					_PatchedModuleObj(getattr(lowerCamelCase_,					lowerCamelCase_,					lowerCamelCase_			),					attrs=self.attrs			)			)
											lowercase__					:      Union[str, Any]      =		getattr(lowerCamelCase_,					lowerCamelCase_			)
									# finally set the target attribute
									setattr(lowerCamelCase_,					lowerCamelCase_,					self.new			)

        # Patch attribute itself:
        # it's used for builtins like "open",
        # and also to patch "os.path.join" we may also need to patch "join"
        # itself if it was imported as "from os.path import join".

			if submodules:  # if it's an attribute of a submodule like "os.path.join"
					try:
							lowercase__					:      str      =		getattr(import_module('.'.join(lowerCamelCase_			)			),					lowerCamelCase_			)
					except (AttributeError, ModuleNotFoundError):
							return
					# We iterate over all the globals in self.obj in case we find "os.path.join"
					for attr in self.obj.__dir__():
							# We don't check for the name of the global, but rather if its value *is* "os.path.join".
							# This allows to patch renamed attributes like "from os.path import join as pjoin".
							if getattr(self.obj,					lowerCamelCase_			) is attr_value:
									lowercase__					:      List[str]      =		getattr(self.obj,					lowerCamelCase_			)
									setattr(self.obj,					lowerCamelCase_,					self.new			)
			elif target_attr in globals()["__builtins__"]:  # if it'a s builtin like "open"
					lowercase__					:      List[str]      =		globals()['__builtins__'][target_attr]
					setattr(self.obj,					lowerCamelCase_,					self.new			)
			else:
					raise RuntimeError(F"""Tried to patch attribute {target_attr} instead of a submodule."""			)

	def __exit__(						self:						List[Any],					*lowerCamelCase_:						int			):
			for attr in list(self.original			):
					setattr(self.obj,					lowerCamelCase_,					self.original.pop(lowerCamelCase_			)			)

	def    snake_case__(						self:						Tuple			):
			self.__enter__()
			self._active_patches.append(self			)





	def    snake_case__(						self:						Tuple			):
			try:
					self._active_patches.remove(self			)
			except ValueError:
					# If the patch hasn't been started this will fail
					return None

			return self.__exit__()









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


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

__UpperCamelCase:	Optional[int] = {
    """google/mobilenet_v1_1.0_224""": """https://huggingface.co/google/mobilenet_v1_1.0_224/resolve/main/config.json""",
    """google/mobilenet_v1_0.75_192""": """https://huggingface.co/google/mobilenet_v1_0.75_192/resolve/main/config.json""",
    # See all MobileNetV1 models at https://huggingface.co/models?filter=mobilenet_v1
}


class       __lowerCAmelCase					(       _UpperCamelCase      ):


	'''simple docstring'''





	_A													=				"mobilenet_v1"

	def __init__(						self:						Dict,					lowerCamelCase_:						Any=3,					lowerCamelCase_:						Dict=224,					lowerCamelCase_:						int=1.0,					lowerCamelCase_:						List[Any]=8,					lowerCamelCase_:						int="relu6",					lowerCamelCase_:						Optional[int]=True,					lowerCamelCase_:						Any=0.9_9_9,					lowerCamelCase_:						List[str]=0.0_2,					lowerCamelCase_:						Optional[int]=0.0_0_1,					**lowerCamelCase_:						Tuple,					):
			super().__init__(**lowerCamelCase_			)

			if depth_multiplier <= 0:
					raise ValueError('depth_multiplier must be greater than zero.'			)

			lowercase__					:      Optional[int]      =		num_channels
			lowercase__					:      List[Any]      =		image_size
			lowercase__					:      str      =		depth_multiplier
			lowercase__					:      Optional[Any]      =		min_depth
			lowercase__					:      int      =		hidden_act
			lowercase__					:      Dict      =		tf_padding
			lowercase__					:      Optional[Any]      =		classifier_dropout_prob
			lowercase__					:      int      =		initializer_range
			lowercase__					:      Any      =		layer_norm_eps


class       __lowerCAmelCase					(       _UpperCamelCase      ):


	'''simple docstring'''





	_A													=				version.parse("1.11"      )

	@property
	def    snake_case__(						self:						Optional[int]			):
			return OrderedDict([('pixel_values', {0: 'batch'})]			)

	@property
	def    snake_case__(						self:						Dict			):
			if self.task == "image-classification":
					return OrderedDict([('logits', {0: 'batch'})]			)
			else:
					return OrderedDict([('last_hidden_state', {0: 'batch'}), ('pooler_output', {0: 'batch'})]			)





	@property
	def    snake_case__(						self:						List[Any]			):
			return 1E-4


