



'''simple docstring'''






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__:  List[Any]				      =     {
    """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 							SCREAMING_SNAKE_CASE(				UpperCAmelCase_     ):







	"""simple docstring"""






	lowerCamelCase__     					=			'mobilenet_v1'







	def __init__(		self     :	List[Any]						,     __snake_case     :	Dict=3						,     __snake_case     :	Optional[Any]=224						,     __snake_case     :	Optional[int]=1.0						,     __snake_case     :	Dict=8						,     __snake_case     :	Optional[Any]="relu6"						,     __snake_case     :	Optional[Any]=True						,     __snake_case     :	Dict=0.9_99						,     __snake_case     :	Dict=0.02						,     __snake_case     :	Any=0.0_01						,     **__snake_case     :	int						,     )     ->						str:
								super().__init__(**SCREAMING_SNAKE_CASE_						)

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

								UpperCAmelCase					:			List[Any]									=						num_channels
								UpperCAmelCase					:			Optional[Any]									=						image_size
								UpperCAmelCase					:			Union[str, Any]									=						depth_multiplier
								UpperCAmelCase					:			Optional[Any]									=						min_depth
								UpperCAmelCase					:			Tuple									=						hidden_act
								UpperCAmelCase					:			Any									=						tf_padding
								UpperCAmelCase					:			int									=						classifier_dropout_prob
								UpperCAmelCase					:			Optional[int]									=						initializer_range
								UpperCAmelCase					:			Tuple									=						layer_norm_eps

class 							SCREAMING_SNAKE_CASE(				UpperCAmelCase_     ):







	"""simple docstring"""






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







	@property
	def 	A      (		self     :	List[Any]						)     ->						Dict:
								return OrderedDict([('''pixel_values''', {0: '''batch'''})]						)







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




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







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







# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse

from ...utils.dataclasses import (
    ComputeEnvironment,
    DistributedType,
    DynamoBackend,
    PrecisionType,
    SageMakerDistributedType,
)
from ..menu import BulletMenu


lowerCamelCase__     :		Optional[int]        = [
    """EAGER""",
    """AOT_EAGER""",
    """INDUCTOR""",
    """NVFUSER""",
    """AOT_NVFUSER""",
    """AOT_CUDAGRAPHS""",
    """OFI""",
    """FX2TRT""",
    """ONNXRT""",
    """IPEX""",
]

def 		UpperCamelCase						(   lowercase_			,			lowercase_=None			,			lowercase_=None			,			lowercase_=None )		->						Optional[Any]:


  '''simple docstring'''






  lowercase__	: List[Any]     		=   True
  while ask_again:
    lowercase__	: Tuple     		=   input(lowercase_ )
    try:
      if default is not None and len(lowercase_ ) == 0:
        return default
      return convert_value(lowercase_ ) if convert_value is not None else result
    except Exception:
      if error_message is not None:
        print(lowercase_ )

def 		UpperCamelCase						(   lowercase_			,			lowercase_=[]			,			lowercase_=None			,			lowercase_=0 )		->						Union[str, Any]:


  '''simple docstring'''






  lowercase__	: List[Any]     		=   BulletMenu(lowercase_			,			lowercase_ )
  lowercase__	: Any     		=   menu.run(default_choice=lowercase_ )
  return convert_value(lowercase_ ) if convert_value is not None else result

def 		UpperCamelCase						(   lowercase_ )		->						str:


  '''simple docstring'''






  lowercase__	: Union[str, Any]     		=   int(lowercase_ )
  return ComputeEnvironment(["""LOCAL_MACHINE""", """AMAZON_SAGEMAKER"""][value] )

def 		UpperCamelCase						(   lowercase_ )		->						Optional[int]:


  '''simple docstring'''






  lowercase__	: List[str]     		=   int(lowercase_ )
  return DistributedType(["""NO""", """MULTI_CPU""", """MULTI_XPU""", """MULTI_GPU""", """MULTI_NPU""", """TPU"""][value] )

def 		UpperCamelCase						(   lowercase_ )		->						str:


  '''simple docstring'''






  lowercase__	: str     		=   int(lowercase_ )
  return DynamoBackend(DYNAMO_BACKENDS[value] ).value

def 		UpperCamelCase						(   lowercase_ )		->						Union[str, Any]:


  '''simple docstring'''






  lowercase__	: List[Any]     		=   int(lowercase_ )
  return PrecisionType(["""no""", """fp16""", """bf16""", """fp8"""][value] )

def 		UpperCamelCase						(   lowercase_ )		->						Optional[int]:


  '''simple docstring'''






  lowercase__	: List[Any]     		=   int(lowercase_ )
  return SageMakerDistributedType(["""NO""", """DATA_PARALLEL""", """MODEL_PARALLEL"""][value] )

def 		UpperCamelCase						(   lowercase_ )		->						Optional[int]:


  '''simple docstring'''






  return {"yes": True, "no": False}[value.lower()]



class    _snake_case (						argparse.RawDescriptionHelpFormatter				):


 def   lowercase__  (       self       ,	SCREAMING_SNAKE_CASE_       ,	SCREAMING_SNAKE_CASE_       ,	SCREAMING_SNAKE_CASE_       ,	SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   lowercase__	: int     		=   super()._format_usage(SCREAMING_SNAKE_CASE_       ,	SCREAMING_SNAKE_CASE_       ,	SCREAMING_SNAKE_CASE_       ,	SCREAMING_SNAKE_CASE_)
   lowercase__	: Optional[Any]     		=   usage.replace("""<command> [<args>] """       ,	"""""")
   return usage






