


'''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 	UpperCamelCase__(       unittest.TestCase	):




				@slow
				def 					a__(		self      :			Tuple				)->					Optional[int]:

										"""simple docstring"""




										UpperCAmelCase					    =     TFXLMRobertaModel.from_pretrained('''jplu/tf-xlm-roberta-base'''				)

										UpperCAmelCase					    =     {
										    '''input_ids''': tf.convert_to_tensor([[0, 2646, 10269, 83, 99942, 2]]				,   dtype=tf.intaa				),  # "My dog is cute"
										    '''attention_mask''': tf.convert_to_tensor([[1, 1, 1, 1, 1, 1]]				,   dtype=tf.intaa				),
										}

										UpperCAmelCase					    =     model(lowerCAmelCase				)['''last_hidden_state''']
										UpperCAmelCase					    =     tf.TensorShape((1, 6, 768)				)
										self.assertEqual(output.shape				,   lowerCAmelCase				)
										# compare the actual values for a slice.
										UpperCAmelCase					    =     tf.convert_to_tensor(
										    [
										        [
										            [0.0681762, 0.10894451, 0.06772504],
										            [-0.06423668, 0.02366615, 0.04329344],
										            [-0.06057295, 0.09974135, -0.00070584],
										        ]
										    ]				,   dtype=tf.floataa				,   )

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









'''simple docstring'''



def 				lowerCamelCase__				(	A       :      int				,       A       :      int					):




						'''simple docstring'''






						return int(input_a == input_a == 0					)


def 				lowerCamelCase__				(	):




						'''simple docstring'''






						print('''Truth Table of NOR Gate:'''					)
						print('''|   Input 1   |  Input 2  | Output |'''					)
						print(f"""|      0      |    0      |  {nor_gate(0				,       0					)}     |"""					)
						print(f"""|      0      |    1      |  {nor_gate(0				,       1					)}     |"""					)
						print(f"""|      1      |    0      |  {nor_gate(1				,       0					)}     |"""					)
						print(f"""|      1      |    1      |  {nor_gate(1				,       1					)}     |"""					)


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	main()





