






'''simple docstring'''







from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow


if is_tf_available():
			import numpy as np
			import tensorflow as tf

			from transformers import TFXLMRobertaModel

@require_tf
@require_sentencepiece
@require_tokenizers
class _lowercase     (    unittest.TestCase		):




							@slow
							def 		lowerCamelCase_    (							self:    Optional[Any]					):
														lowerCamelCase__ :     List[str]	  =	TFXLMRobertaModel.from_pretrained("""jplu/tf-xlm-roberta-base"""					)

														lowerCamelCase__ :     Tuple	  =	{
														    """input_ids""": tf.convert_to_tensor([[0, 2_646, 10_269, 83, 99_942, 2]]      ,							dtype=tf.intaa					),  # "My dog is cute"
														    """attention_mask""": tf.convert_to_tensor([[1, 1, 1, 1, 1, 1]]      ,							dtype=tf.intaa					),
														}

														lowerCamelCase__ :     Union[str, Any]	  =	model(UpperCamelCase__					)["""last_hidden_state"""]
														lowerCamelCase__ :     List[str]	  =	tf.TensorShape((1, 6, 768)					)
														self.assertEqual(output.shape      ,							UpperCamelCase__					)
														# compare the actual values for a slice.
														lowerCamelCase__ :     List[Any]	  =	tf.convert_to_tensor(
														    [
														        [
														            [0.0_681_762, 0.10_894_451, 0.06_772_504],
														            [-0.06_423_668, 0.02_366_615, 0.04_329_344],
														            [-0.06_057_295, 0.09_974_135, -0.00_070_584],
														        ]
														    ]      ,							dtype=tf.floataa      ,							)

														self.assertTrue(np.allclose(output[:, :3, :3].numpy()      ,							expected_slice.numpy()      ,							atol=1e-4					)					)









'''simple docstring'''







from math import asin, atan, cos, radians, sin, sqrt, tan

_A     :      List[str]   					=637_8137.0
_A     :      Dict   					=635_6752.31_4245
_A     :      int   					=6_378_137





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase    ,      UpperCamelCase    ,      UpperCamelCase    ,      UpperCamelCase				)				->	float:
							lowerCamelCase__ :     str	  =	(AXIS_A - AXIS_B) / AXIS_A
							lowerCamelCase__ :     Dict	  =	atan((1 - flattening) * tan(radians(UpperCamelCase				)				)				)
							lowerCamelCase__ :     Dict	  =	atan((1 - flattening) * tan(radians(UpperCamelCase				)				)				)
							lowerCamelCase__ :     Optional[Any]	  =	radians(UpperCamelCase				)
							lowerCamelCase__ :     List[Any]	  =	radians(UpperCamelCase				)
							# Equation
							lowerCamelCase__ :     Tuple	  =	sin((phi_a - phi_a) / 2				)
							lowerCamelCase__ :     List[Any]	  =	sin((lambda_a - lambda_a) / 2				)
							# Square both values
							sin_sq_phi *= sin_sq_phi
							sin_sq_lambda *= sin_sq_lambda
							lowerCamelCase__ :     Tuple	  =	sqrt(sin_sq_phi + (cos(UpperCamelCase				) * cos(UpperCamelCase				) * sin_sq_lambda)				)
							return 2 * RADIUS * asin(UpperCamelCase				)


if __name__ == "__main__":
			import doctest

			doctest.testmod()

