
import unittest

import numpy as np

from transformers import ElectraConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
							from transformers.models.electra.modeling_flax_electra import (
							    FlaxElectraForCausalLM,
							    FlaxElectraForMaskedLM,
							    FlaxElectraForMultipleChoice,
							    FlaxElectraForPreTraining,
							    FlaxElectraForQuestionAnswering,
							    FlaxElectraForSequenceClassification,
							    FlaxElectraForTokenClassification,
							    FlaxElectraModel,
							)







class 							lowercase						(   unittest.TestCase						):




							def __init__(							self  ,A__  ,A__=1_3  ,A__=7  ,A__=True  ,A__=True  ,A__=True  ,A__=True  ,A__=9_9  ,A__=2_4  ,A__=3_2  ,A__=5  ,A__=4  ,A__=3_7  ,A__="gelu"  ,A__=0.1  ,A__=0.1  ,A__=5_1_2  ,A__=1_6  ,A__=2  ,A__=0.02  ,A__=4  ,):
												lowercase		      =		parent
												lowercase		      =		batch_size
												lowercase		      =		seq_length
												lowercase		      =		is_training
												lowercase		      =		use_attention_mask
												lowercase		      =		use_token_type_ids
												lowercase		      =		use_labels
												lowercase		      =		vocab_size
												lowercase		      =		hidden_size
												lowercase		      =		embedding_size
												lowercase		      =		num_hidden_layers
												lowercase		      =		num_attention_heads
												lowercase		      =		intermediate_size
												lowercase		      =		hidden_act
												lowercase		      =		hidden_dropout_prob
												lowercase		      =		attention_probs_dropout_prob
												lowercase		      =		max_position_embeddings
												lowercase		      =		type_vocab_size
												lowercase		      =		type_sequence_label_size
												lowercase		      =		initializer_range
												lowercase		      =		num_choices




							def 					A__ (							self):
												lowercase		      =		ids_tensor([self.batch_size, self.seq_length]  ,self.vocab_size)

												lowercase		      =		None
												if self.use_attention_mask:
																	lowercase		      =		random_attention_mask([self.batch_size, self.seq_length])

												lowercase		      =		None
												if self.use_token_type_ids:
																	lowercase		      =		ids_tensor([self.batch_size, self.seq_length]  ,self.type_vocab_size)

												lowercase		      =		ElectraConfig(
												    vocab_size=self.vocab_size  ,hidden_size=self.hidden_size  ,embedding_size=self.embedding_size  ,num_hidden_layers=self.num_hidden_layers  ,num_attention_heads=self.num_attention_heads  ,intermediate_size=self.intermediate_size  ,hidden_act=self.hidden_act  ,hidden_dropout_prob=self.hidden_dropout_prob  ,attention_probs_dropout_prob=self.attention_probs_dropout_prob  ,max_position_embeddings=self.max_position_embeddings  ,type_vocab_size=self.type_vocab_size  ,initializer_range=self.initializer_range  ,)

												return config, input_ids, token_type_ids, attention_mask





							def 					A__ (							self):
												lowercase		      =		self.prepare_config_and_inputs()
												lowercase		      =		config_and_inputs
												lowercase		      =		{"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": attention_mask}
												return config, inputs_dict







@require_flax
class 							lowercase						(   lowercase__			,    unittest.TestCase						):
							lowercase_			:			List[str]			   =True

							lowercase_			:			List[Any]			   =(
							    (
							        FlaxElectraModel,
							        FlaxElectraForCausalLM,
							        FlaxElectraForMaskedLM,
							        FlaxElectraForPreTraining,
							        FlaxElectraForTokenClassification,
							        FlaxElectraForQuestionAnswering,
							        FlaxElectraForMultipleChoice,
							        FlaxElectraForSequenceClassification,
							    )
							    if is_flax_available()
							    else ()
							)




							def 					A__ (							self):
												lowercase		      =		FlaxElectraModelTester(self)





							@slow
							def 					A__ (							self):





												for model_class_name in self.all_model_classes:
																	if model_class_name == FlaxElectraForMaskedLM:
																						lowercase		      =		model_class_name.from_pretrained('''google/electra-small-generator''')
																	else:
																						lowercase		      =		model_class_name.from_pretrained('''google/electra-small-discriminator''')
																	lowercase		      =		model(np.ones((1, 1)))
																	self.assertIsNotNone(A__)









import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute







def  _snake_case			(							__snake_case = 1       ,	__snake_case = 1     )  ->  qiskit.result.counts.Counts:






      '''simple docstring'''







      if isinstance(__snake_case       ,	__snake_case     ) or isinstance(__snake_case       ,	__snake_case     ):
            raise TypeError("inputs must be integers."     )
      if (bit_a < 0) or (bit_a < 0):
            raise ValueError("inputs must be positive."     )
      if (math.floor(__snake_case     ) != bit_a) or (math.floor(__snake_case     ) != bit_a):
            raise ValueError("inputs must be exact integers."     )
      if (bit_a > 1) or (bit_a > 1):
            raise ValueError("inputs must be less or equal to 1."     )

      # build registers
      UpperCAmelCase_	:						Union[str, Any]					   =		QuantumRegister(2       ,	"qr"     )
      UpperCAmelCase_	:						Tuple					   =		ClassicalRegister(2       ,	"cr"     )

      UpperCAmelCase_	:						Union[str, Any]					   =		QuantumCircuit(__snake_case       ,	__snake_case     )

      # entanglement the qubits
      quantum_circuit.h(1     )
      quantum_circuit.cx(1       ,	0     )

      # send the information
      UpperCAmelCase_	:						Any					   =		str(__snake_case     ) + str(__snake_case     )

      if c_information == "11":
            quantum_circuit.x(1     )
            quantum_circuit.z(1     )
      elif c_information == "10":
            quantum_circuit.z(1     )
      elif c_information == "01":
            quantum_circuit.x(1     )
      else:
            quantum_circuit.i(1     )

      # unentangled the circuit
      quantum_circuit.cx(1       ,	0     )
      quantum_circuit.h(1     )

      # measure the circuit
      quantum_circuit.measure(__snake_case       ,	__snake_case     )

      UpperCAmelCase_	:						Union[str, Any]					   =		Aer.get_backend("aer_simulator"     )
      UpperCAmelCase_	:						Dict					   =		execute(__snake_case       ,	__snake_case       ,	shots=1_0_0_0     )

      return job.result().get_counts(__snake_case     )


if __name__ == "__main__":
   print(F'''Counts for classical state send: {superdense_coding(1,1)}''')
