


'''simple docstring'''


import numpy as np

from transformers import Pipeline






def        __lowerCAmelCase       (__lowerCAmelCase      ):
		_UpperCAmelCase						:				Dict	    =					np.max(__lowerCAmelCase					,       axis=-1					,       keepdims=__lowerCAmelCase      )
		_UpperCAmelCase						:				Optional[Any]	    =					np.exp(outputs - maxes      )
		return shifted_exp / shifted_exp.sum(axis=-1					,       keepdims=__lowerCAmelCase      )






class 		lowerCAmelCase__	(	UpperCAmelCase__		):




			def 							lowerCAmelCase__			(						self     :   str		,     **lowerCamelCase__     :   Tuple       )      ->Union[str, Any]:



					'''simple docstring'''







					_UpperCAmelCase						:				Tuple	    =					{}
					if "second_text" in kwargs:
							_UpperCAmelCase						:				Dict	    =					kwargs["second_text"]
					return preprocess_kwargs, {}, {}




			def 							lowerCAmelCase__			(						self     :   List[Any]		,     lowerCamelCase__     :   Any		,     lowerCamelCase__     :   str=None       )      ->Union[str, Any]:



					'''simple docstring'''







					return self.tokenizer(lowerCamelCase__		,     text_pair=lowerCamelCase__		,     return_tensors=self.framework       )




			def 							lowerCAmelCase__			(						self     :   str		,     lowerCamelCase__     :   Optional[Any]       )      ->Optional[Any]:



					'''simple docstring'''







					return self.model(**lowerCamelCase__       )






			def 							lowerCAmelCase__			(						self     :   Dict		,     lowerCamelCase__     :   str       )      ->Union[str, Any]:



					'''simple docstring'''







					_UpperCAmelCase						:				List[str]	    =					model_outputs.logits[0].numpy()
					_UpperCAmelCase						:				Optional[Any]	    =					softmax(lowerCamelCase__       )

					_UpperCAmelCase						:				Optional[int]	    =					np.argmax(lowerCamelCase__       )
					_UpperCAmelCase						:				Dict	    =					self.model.config.idalabel[best_class]
					_UpperCAmelCase						:				Union[str, Any]	    =					probabilities[best_class].item()
					_UpperCAmelCase						:				Dict	    =					logits.tolist()
					return {"label": label, "score": score, "logits": logits}







'''simple docstring'''


import math






def        __lowerCAmelCase       (__lowerCAmelCase      ):
		return math.sqrt(__lowerCAmelCase      ) * math.sqrt(__lowerCAmelCase      ) == num






def        __lowerCAmelCase       (__lowerCAmelCase      ):
		_UpperCAmelCase						:				int	    =					0
		_UpperCAmelCase						:				Tuple	    =					n
		while left <= right:
				_UpperCAmelCase						:				int	    =					(left + right) // 2
				if mid**2 == n:
						return True
				elif mid**2 > n:
						_UpperCAmelCase						:				str	    =					mid - 1
				else:
						_UpperCAmelCase						:				List[str]	    =					mid + 1
		return False


if __name__ == "__main__":
						import doctest

						doctest.testmod()



