





'''simple docstring'''

import torch

from transformers import AutoModel






class        UpperCAmelCase     (	torch.nn.Module    ):
	def __init__(    self				:Optional[int]						,	lowercase_				:Union[str, Any]="sayef/fsner-bert-base-uncased"							)->							Tuple:
					super(lowerCamelCase_						,	self							).__init__()

					A__    =      AutoModel.from_pretrained(lowerCamelCase_						,	return_dict=lowerCamelCase_							)
					A__    =      torch.nn.CosineSimilarity(3						,	1E-08							)
					A__    =      torch.nn.Softmax(dim=1							)
	def 					UpperCAmelCase_							(    self				:List[str]						,	**lowercase_				:List[Any]							)->							str:
					return self.bert(**lowerCamelCase_							).last_hidden_state
	def 					UpperCAmelCase_							(    self				:Tuple						,	lowercase_				:List[Any]							)->							Union[str, Any]:
					return token_embeddings.sum(2						,	keepdim=lowerCamelCase_							)
	def 					UpperCAmelCase_							(    self				:str						,	lowercase_				:List[str]						,	lowercase_				:List[str]						,	lowercase_				:List[str]=1							)->							Optional[int]:
					return self.softmax(T * self.cos(lowerCamelCase_						,	lowerCamelCase_							)							)



	def 					UpperCAmelCase_							(    self				:str						,	lowercase_				:str						,	lowercase_				:Any							)->							List[str]:
					A__    =      W_supports["sizes"].tolist()
					A__    =      W_supports["start_token_id"].item()
					A__    =      W_supports["end_token_id"].item()

					del W_supports["sizes"]
					del W_supports["start_token_id"]
					del W_supports["end_token_id"]

					A__    =      self.BERT(**lowerCamelCase_							)
					A__    =      self.BERT(**lowerCamelCase_							)

					A__    =      None
					A__    =      None

					A__    =      W_supports["input_ids"] == start_token_id
					A__    =      W_supports["input_ids"] == end_token_id

					for i, size in enumerate(lowerCamelCase_							):
									if i == 0:
													A__    =      0
									else:
													A__    =      support_sizes[i - 1]

									A__    =      S[s : s + size][start_token_masks[s : s + size]]
									A__    =      S[s : s + size][end_token_masks[s : s + size]]

									A__    =      torch.matmul(q[i]						,	s_start.T							).sum(1							).softmax(0							)
									A__    =      torch.matmul(q[i]						,	s_end.T							).sum(1							).softmax(0							)

									if p_starts is not None:
													A__    =      torch.vstack((p_starts, p_start)							)
													A__    =      torch.vstack((p_ends, p_end)							)
									else:
													A__    =      p_start
													A__    =      p_end

					return p_starts, p_ends










'''simple docstring'''

import qiskit





def 						UpperCamelCase    (							_lowerCamelCase : int						,	_lowerCamelCase : int	):
    A__    =      qiskit.Aer.get_backend("aer_simulator"	)

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

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

    # Execute the circuit on the simulator
    A__    =      qiskit.execute(_lowerCamelCase						,	_lowerCamelCase						,	shots=10_00	)

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


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



