

import math

import qiskit
def      _lowerCAmelCase(	__A = 1   ,       __A = 1   ,       __A = 1			):



		if (
		    isinstance(__A   ,       __A			)
		    or isinstance(__A   ,       __A			)
		    or isinstance(__A   ,       __A			)
		):
				raise TypeError("inputs must be integers."			)

		if (input_a < 0) or (input_a < 0) or (carry_in < 0):
				raise ValueError("inputs must be positive."			)

		if (
		    (math.floor(__A			) != input_a)
		    or (math.floor(__A			) != input_a)
		    or (math.floor(__A			) != carry_in)
		):
				raise ValueError("inputs must be exact integers."			)

		if (input_a > 2) or (input_a > 2) or (carry_in > 2):
				raise ValueError("inputs must be less or equal to 2."			)

		# build registers
		UpperCAmelCase					      =  qiskit.QuantumRegister(4   ,       "qr"			)
		UpperCAmelCase					      =  qiskit.ClassicalRegister(2   ,       "cr"			)
		# list the entries
		UpperCAmelCase					      =  [input_a, input_a, carry_in]

		UpperCAmelCase					      =  qiskit.QuantumCircuit(__A   ,       __A			)

		for i in range(0   ,       3			):
				if entry[i] == 2:
						quantum_circuit.h(__A			)  # for hadamard entries
				elif entry[i] == 1:
						quantum_circuit.x(__A			)  # for 1 entries
				elif entry[i] == 0:
						quantum_circuit.i(__A			)  # for 0 entries

    # build the circuit
		quantum_circuit.ccx(0   ,       1   ,       3			)  # ccx = toffoli gate
		quantum_circuit.cx(0   ,       1			)
		quantum_circuit.ccx(1   ,       2   ,       3			)
		quantum_circuit.cx(1   ,       2			)
		quantum_circuit.cx(0   ,       1			)

		quantum_circuit.measure([2, 3]   ,       __A			)  # measure the last two qbits

		UpperCAmelCase					      =  qiskit.Aer.get_backend("aer_simulator"			)
		UpperCAmelCase					      =  qiskit.execute(__A   ,       __A   ,       shots=1000			)

		return job.result().get_counts(__A			)


if __name__ == "__main__":
						print(f"Total sum count for state is: {quantum_full_adder(1, 1, 1)}")






from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowerCAmelCase__       = logging.get_logger(__name__)

lowerCAmelCase__       = {
    "facebook/convnextv2-tiny-1k-224": "https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json",
}






class 						__magic_name__    (       _snake_case	,						_snake_case    ):
 UpperCAmelCase							    =						"""convnextv2"""


 def __init__(						self		: Optional[Any]			,						lowerCAmelCase__		: List[Any]=3			,						lowerCAmelCase__		: str=4			,						lowerCAmelCase__		: Dict=4			,						lowerCAmelCase__		: Optional[Any]=None			,						lowerCAmelCase__		: Optional[Any]=None			,						lowerCAmelCase__		: str="gelu"			,						lowerCAmelCase__		: Optional[int]=0.02			,						lowerCAmelCase__		: Dict=1e-1_2			,						lowerCAmelCase__		: str=0.0			,						lowerCAmelCase__		: str=2_2_4			,						lowerCAmelCase__		: int=None			,						lowerCAmelCase__		: List[Any]=None			,						**lowerCAmelCase__		: List[Any]			,						)    ->      List[Any]:
   super().__init__(**lowerCAmelCase__    )

   UpperCAmelCase					      =  num_channels
   UpperCAmelCase					      =  patch_size
   UpperCAmelCase					      =  num_stages
   UpperCAmelCase					      =  [9_6, 1_9_2, 3_8_4, 7_6_8] if hidden_sizes is None else hidden_sizes
   UpperCAmelCase					      =  [3, 3, 9, 3] if depths is None else depths
   UpperCAmelCase					      =  hidden_act
   UpperCAmelCase					      =  initializer_range
   UpperCAmelCase					      =  layer_norm_eps
   UpperCAmelCase					      =  drop_path_rate
   UpperCAmelCase					      =  image_size
   UpperCAmelCase					      =  ["stem"] + [f"stage{idx}" for idx in range(1			,						len(self.depths    ) + 1    )]
   UpperCAmelCase      ,	UpperCAmelCase					      =  get_aligned_output_features_output_indices(
       out_features=lowerCAmelCase__			,						out_indices=lowerCAmelCase__			,						stage_names=self.stage_names    )



