


'''simple docstring'''


import copy
from collections import OrderedDict
from typing import Dict, Mapping

from packaging import version

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


lowerCamelCase__					=   logging.get_logger(__name__)

lowerCamelCase__					=   {
    """facebook/detr-resnet-50""": """https://huggingface.co/facebook/detr-resnet-50/resolve/main/config.json""",
    # See all DETR models at https://huggingface.co/models?filter=detr
}






class 		lowerCAmelCase__	(	_UpperCAmelCase		):
			lowerCAmelCase       :		Tuple				      =   '''detr'''
			lowerCAmelCase       :		Optional[int]				      =   ['''past_key_values''']
			lowerCAmelCase       :		Optional[Any]				      =   {
			    '''hidden_size''': '''d_model''',
			    '''num_attention_heads''': '''encoder_attention_heads''',
			}




			def __init__(						self     :   List[Any]		,     lowerCamelCase__     :   Dict=True		,     lowerCamelCase__     :   Optional[int]=None		,     lowerCamelCase__     :   List[Any]=3		,     lowerCamelCase__     :   int=1_00		,     lowerCamelCase__     :   Any=6		,     lowerCamelCase__     :   str=20_48		,     lowerCamelCase__     :   Optional[Any]=8		,     lowerCamelCase__     :   Optional[int]=6		,     lowerCamelCase__     :   Tuple=20_48		,     lowerCamelCase__     :   Tuple=8		,     lowerCamelCase__     :   Any=0.0		,     lowerCamelCase__     :   List[str]=0.0		,     lowerCamelCase__     :   List[str]=True		,     lowerCamelCase__     :   str="relu"		,     lowerCamelCase__     :   Optional[int]=2_56		,     lowerCamelCase__     :   int=0.1		,     lowerCamelCase__     :   Optional[int]=0.0		,     lowerCamelCase__     :   int=0.0		,     lowerCamelCase__     :   Optional[int]=0.0_2		,     lowerCamelCase__     :   List[Any]=1.0		,     lowerCamelCase__     :   Dict=False		,     lowerCamelCase__     :   int="sine"		,     lowerCamelCase__     :   Union[str, Any]="resnet50"		,     lowerCamelCase__     :   Union[str, Any]=True		,     lowerCamelCase__     :   Optional[Any]=False		,     lowerCamelCase__     :   Tuple=1		,     lowerCamelCase__     :   str=5		,     lowerCamelCase__     :   Dict=2		,     lowerCamelCase__     :   Tuple=1		,     lowerCamelCase__     :   List[str]=1		,     lowerCamelCase__     :   Union[str, Any]=5		,     lowerCamelCase__     :   Optional[int]=2		,     lowerCamelCase__     :   Optional[Any]=0.1		,     **lowerCamelCase__     :   int		,     )      ->Optional[Any]:



					'''simple docstring'''







					if backbone_config is not None and use_timm_backbone:
							raise ValueError("You can\'t specify both `backbone_config` and `use_timm_backbone`."       )

					if not use_timm_backbone:
							if backbone_config is None:
									logger.info("`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."       )
									_UpperCAmelCase						:				List[str]	    =					CONFIG_MAPPING["resnet"](out_features=["stage4"]       )
							elif isinstance(lowerCAmelCase__		,     lowerCAmelCase__       ):
									_UpperCAmelCase						:				Union[str, Any]	    =					backbone_config.get("model_type"       )
									_UpperCAmelCase						:				List[str]	    =					CONFIG_MAPPING[backbone_model_type]
									_UpperCAmelCase						:				List[str]	    =					config_class.from_dict(lowerCAmelCase__       )
							# set timm attributes to None
							_UpperCAmelCase    ,			_UpperCAmelCase    ,			_UpperCAmelCase						:				Any	    =					None, None, None

					_UpperCAmelCase						:				str	    =					use_timm_backbone
					_UpperCAmelCase						:				int	    =					backbone_config
					_UpperCAmelCase						:				Optional[Any]	    =					num_channels
					_UpperCAmelCase						:				List[Any]	    =					num_queries
					_UpperCAmelCase						:				Tuple	    =					d_model
					_UpperCAmelCase						:				List[Any]	    =					encoder_ffn_dim
					_UpperCAmelCase						:				Any	    =					encoder_layers
					_UpperCAmelCase						:				Optional[int]	    =					encoder_attention_heads
					_UpperCAmelCase						:				List[str]	    =					decoder_ffn_dim
					_UpperCAmelCase						:				Dict	    =					decoder_layers
					_UpperCAmelCase						:				Dict	    =					decoder_attention_heads
					_UpperCAmelCase						:				Any	    =					dropout
					_UpperCAmelCase						:				int	    =					attention_dropout
					_UpperCAmelCase						:				List[Any]	    =					activation_dropout
					_UpperCAmelCase						:				Optional[int]	    =					activation_function
					_UpperCAmelCase						:				Any	    =					init_std
					_UpperCAmelCase						:				Dict	    =					init_xavier_std
					_UpperCAmelCase						:				Any	    =					encoder_layerdrop
					_UpperCAmelCase						:				Union[str, Any]	    =					decoder_layerdrop
					_UpperCAmelCase						:				List[Any]	    =					encoder_layers
					_UpperCAmelCase						:				int	    =					auxiliary_loss
					_UpperCAmelCase						:				Union[str, Any]	    =					position_embedding_type
					_UpperCAmelCase						:				Tuple	    =					backbone
					_UpperCAmelCase						:				Tuple	    =					use_pretrained_backbone
					_UpperCAmelCase						:				str	    =					dilation
					# Hungarian matcher
					_UpperCAmelCase						:				Tuple	    =					class_cost
					_UpperCAmelCase						:				Optional[int]	    =					bbox_cost
					_UpperCAmelCase						:				int	    =					giou_cost
					# Loss coefficients
					_UpperCAmelCase						:				Tuple	    =					mask_loss_coefficient
					_UpperCAmelCase						:				Tuple	    =					dice_loss_coefficient
					_UpperCAmelCase						:				List[str]	    =					bbox_loss_coefficient
					_UpperCAmelCase						:				Optional[Any]	    =					giou_loss_coefficient
					_UpperCAmelCase						:				Any	    =					eos_coefficient
					super().__init__(is_encoder_decoder=lowerCAmelCase__		,     **lowerCAmelCase__       )




			@property
			def 							lowerCAmelCase__			(						self     :   Optional[int]       )      ->int:



					'''simple docstring'''







					return self.encoder_attention_heads




			@property
			def 							lowerCAmelCase__			(						self     :   List[str]       )      ->int:



					'''simple docstring'''







					return self.d_model




			@classmethod
			def 							lowerCAmelCase__			(						cls     :   Dict		,     lowerCamelCase__     :   Dict		,     **lowerCamelCase__     :   List[Any]       )      ->Optional[int]:



					'''simple docstring'''







					return cls(backbone_config=lowerCAmelCase__		,     **lowerCAmelCase__       )






			def 							lowerCAmelCase__			(						self     :   List[Any]       )      ->Dict[str, any]:



					'''simple docstring'''







					_UpperCAmelCase						:				Dict	    =					copy.deepcopy(self.__dict__       )
					if output["backbone_config"] is not None:
							_UpperCAmelCase						:				Tuple	    =					self.backbone_config.to_dict()
					_UpperCAmelCase						:				Union[str, Any]	    =					self.__class__.model_type
					return output






class 		lowerCAmelCase__	(	_UpperCAmelCase		):
			lowerCAmelCase       :		Union[str, Any]				      =   version.parse("1.11"		)




			@property
			def 							lowerCAmelCase__			(						self     :   Any       )      ->Mapping[str, Mapping[int, str]]:



					'''simple docstring'''







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




			@property
			def 							lowerCAmelCase__			(						self     :   Dict       )      ->float:



					'''simple docstring'''







					return 1E-5






			@property
			def 							lowerCAmelCase__			(						self     :   Tuple       )      ->int:



					'''simple docstring'''







					return 12




import qiskit





def 				UpperCAmelCase						(    lowercase							,			lowercase							):







				"""simple docstring"""



				__lowercase 			=							qiskit.Aer.get_backend('''aer_simulator'''							)

				# Create a Quantum Circuit acting on the q register
				__lowercase 			=							qiskit.QuantumCircuit(lowercase							,			lowercase							)

				# Map the quantum measurement to the classical bits
				circuit.measure([0]							,			[0]							)

				# Execute the circuit on the simulator
				__lowercase 			=							qiskit.execute(lowercase							,			lowercase							,			shots=1000							)

				# Return the histogram data of the results of the experiment.
				return job.result().get_counts(lowercase							)


if __name__ == "__main__":
		print(F'''Total count for various states are: {single_qubit_measure(1, 1)}''')