




'''simple docstring'''





import functools
import operator

from ...configuration_utils import PretrainedConfig
from ...utils import logging


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

_SCREAMING_SNAKE_CASE							:     Any   	=				{
    "facebook/hubert-base-ls960": "https://huggingface.co/facebook/hubert-base-ls960/resolve/main/config.json",
    # See all Hubert models at https://huggingface.co/models?filter=hubert
}




class 				_snake_case	(			lowercase_							):
			lowerCAmelCase_  :   str		 =					"hubert"




			def __init__(      self       ,							a__=32       ,							a__=768       ,							a__=12       ,							a__=12       ,							a__=3_072       ,							a__="gelu"       ,							a__=0.1       ,							a__=0.1       ,							a__=0.1       ,							a__=True       ,							a__=0.0       ,							a__=0.1       ,							a__=0.1       ,							a__=0.0_2       ,							a__=1e-5       ,							a__="group"       ,							a__="gelu"       ,							a__=(512, 512, 512, 512, 512, 512, 512)       ,							a__=(5, 2, 2, 2, 2, 2, 2)       ,							a__=(10, 3, 3, 3, 3, 2, 2)       ,							a__=False       ,							a__=128       ,							a__=16       ,							a__=False       ,							a__=True       ,							a__=0.0_5       ,							a__=10       ,							a__=2       ,							a__=0.0       ,							a__=10       ,							a__=0       ,							a__="sum"       ,							a__=False       ,							a__=False       ,							a__=256       ,							a__=0       ,							a__=1       ,							a__=2       ,							**a__       ,							)       ->       int:

										'''simple docstring'''




										super().__init__(**a__       ,							pad_token_id=a__       ,							bos_token_id=a__       ,							eos_token_id=a__							)
										snake_case_			      =   hidden_size
										snake_case_			      =   feat_extract_norm
										snake_case_			      =   feat_extract_activation
										snake_case_			      =   list(a__							)
										snake_case_			      =   list(a__							)
										snake_case_			      =   list(a__							)
										snake_case_			      =   conv_bias
										snake_case_			      =   num_conv_pos_embeddings
										snake_case_			      =   num_conv_pos_embedding_groups
										snake_case_			      =   len(self.conv_dim							)
										snake_case_			      =   num_hidden_layers
										snake_case_			      =   intermediate_size
										snake_case_			      =   hidden_act
										snake_case_			      =   num_attention_heads
										snake_case_			      =   hidden_dropout
										snake_case_			      =   attention_dropout
										snake_case_			      =   activation_dropout
										snake_case_			      =   feat_proj_layer_norm
										snake_case_			      =   feat_proj_dropout
										snake_case_			      =   final_dropout
										snake_case_			      =   layerdrop
										snake_case_			      =   layer_norm_eps
										snake_case_			      =   initializer_range
										snake_case_			      =   vocab_size
										snake_case_			      =   do_stable_layer_norm
										snake_case_			      =   use_weighted_layer_sum
										snake_case_			      =   classifier_proj_size

										if (
										    (len(self.conv_stride							) != self.num_feat_extract_layers)
										    or (len(self.conv_kernel							) != self.num_feat_extract_layers)
										    or (len(self.conv_dim							) != self.num_feat_extract_layers)
										):
																	raise ValueError(
																	    "Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =="
																	    " `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ="
																	    F' {len(self.conv_dim							)}`, `len(config.conv_stride) = {len(self.conv_stride							)}`,'
																	    F' `len(config.conv_kernel) = {len(self.conv_kernel							)}`.'							)

										# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
										snake_case_			      =   apply_spec_augment
										snake_case_			      =   mask_time_prob
										snake_case_			      =   mask_time_length
										snake_case_			      =   mask_time_min_masks
										snake_case_			      =   mask_feature_prob
										snake_case_			      =   mask_feature_length
										snake_case_			      =   mask_feature_min_masks

										# ctc loss
										snake_case_			      =   ctc_loss_reduction
										snake_case_			      =   ctc_zero_infinity




			@property
			def      lowerCAmelCase__       (      self							)       ->       str:

										'''simple docstring'''




										return functools.reduce(operator.mul       ,							self.conv_stride       ,							1							)










'''simple docstring'''





import qiskit
from qiskit.providers import Backend


def   UpperCamelCase_(			snake_case							: int							,       snake_case							: int  ):

							'''simple docstring'''






							snake_case_      ,   snake_case_			      =   bin(snake_case  )[2:], bin(snake_case  )[2:]  # Remove leading '0b'

							# Ensure that both strings are of the same length
							if len(snake_case  ) > len(snake_case  ):
														snake_case_			      =   y.zfill(len(snake_case  )  )
							else:
														snake_case_			      =   x.zfill(len(snake_case  )  )

							# We need (3 * number of bits in the larger number)+1 qBits
							# The second parameter is the number of classical registers, to measure the result
							snake_case_			      =   qiskit.QuantumCircuit((len(snake_case  ) * 3) + 1							,       len(snake_case  ) + 1  )

							# We are essentially "not-ing" the bits that are 1
							# Reversed because it's easier to perform ops on more significant bits
							for i in range(len(snake_case  )  ):
														if x[::-1][i] == "1":
																					circuit.x(snake_case  )
							for j in range(len(snake_case  )  ):
														if y[::-1][j] == "1":
																					circuit.x(len(snake_case  ) + j  )

							return circuit, x, y


def   UpperCamelCase_(			snake_case							: qiskit.QuantumCircuit							,       snake_case							: int							,       snake_case							: int							,       snake_case							: int							,       snake_case							: int							,       ):

							'''simple docstring'''






							circuit.ccx(snake_case							,       snake_case							,       snake_case  )
							circuit.cx(snake_case							,       snake_case  )
							circuit.ccx(snake_case							,       snake_case							,       snake_case  )
							circuit.cx(snake_case							,       snake_case  )
							circuit.cx(snake_case							,       snake_case  )


def   UpperCamelCase_(			snake_case							: int							,       snake_case							: int							,       snake_case							: Backend = qiskit.Aer.get_backend("aer_simulator"  )							,       ):

							'''simple docstring'''






							if vala < 0 or vala < 0:
														raise ValueError("Both Integers must be positive!"  )

							# Store the Integers
							snake_case_      ,   snake_case_      ,   snake_case_			      =   store_two_classics(snake_case							,       snake_case  )
							for i in range(len(snake_case  )  ):
														full_adder(snake_case							,       snake_case							,       len(snake_case  ) + i							,       len(snake_case  ) + len(snake_case  ) + i							,       len(snake_case  ) + len(snake_case  ) + i + 1  )
														circuit.barrier()  # Optional, just for aesthetics

							# Measure the resultant qBits
							for i in range(len(snake_case  ) + 1  ):
														circuit.measure([(len(snake_case  ) * 2) + i]							,       [i]  )

							snake_case_			      =   qiskit.execute(snake_case							,       snake_case							,       shots=1  ).result()

							# The result is in binary. Convert it back to int
							return int(list(res.get_counts()  )[0]							,       2  )


if __name__ == "__main__":
		import doctest

		doctest.testmod()




