'''simple docstring'''





def      lowerCAmelCase_    ( snake_case_	:			int      )   ->				Union[str, Any]:


					'''simple docstring'''




					UpperCAmelCase_	   =       abs(_a      )
					UpperCAmelCase_	   =       0
					while n > 0:
										res += n % 10
										n //= 10
					return res





def      lowerCAmelCase_    ( snake_case_	:			int      )   ->				Tuple:


					'''simple docstring'''




					UpperCAmelCase_	   =       abs(_a      )
					return n if n < 10 else n % 10 + sum_of_digits(n // 10      )





def      lowerCAmelCase_    ( snake_case_	:			int      )   ->				List[str]:


					'''simple docstring'''




					return sum(int(_a      ) for c in str(abs(_a      )      )      )





def      lowerCAmelCase_    ( )   ->				Union[str, Any]:


					'''simple docstring'''




					from collections.abc import Callable
					from timeit import timeit

					def benchmark_a_function(snake_case_	:			Callable ,   snake_case_	:			int      ) -> None:
										UpperCAmelCase_	   =       f"""{func.__name__}({value})"""
										UpperCAmelCase_	   =       timeit(f"""__main__.{call}""" ,   setup="import __main__"      )
										print(f"""{call:56} = {func(_a      )} -- {timing:.4f} seconds"""      )

					for value in (26_21_44, 11_25_89_99_06_84_26_24, 1_26_76_50_60_02_28_22_94_01_49_67_03_20_53_76):
										for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
															benchmark_a_function(_a ,   _a      )
										print()


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				benchmark()





'''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 TFCamembertModel




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



    @slow
    def  _lowercase						(self   :   Dict			):
         UpperCAmelCase_	   =       TFCamembertModel.from_pretrained("jplu/tf-camembert-base"			)

         UpperCAmelCase_	   =       tf.convert_to_tensor(
             [[5, 121, 11, 660, 16, 730, 25543, 110, 83, 6]]       ,      dtype=tf.intaa       ,      )  # J'aime le camembert !"

         UpperCAmelCase_	   =       model(__a			)["last_hidden_state"]
         UpperCAmelCase_	   =       tf.TensorShape((1, 10, 768)			)
         self.assertEqual(output.shape       ,      __a			)
         # compare the actual values for a slice.
         UpperCAmelCase_	   =       tf.convert_to_tensor(
             [[[-0.02_54, 0.02_35, 0.10_27], [0.06_06, -0.18_11, -0.04_18], [-0.15_61, -0.11_27, 0.26_87]]]       ,      dtype=tf.floataa       ,      )
         # camembert = torch.hub.load('pytorch/fairseq', 'camembert.v0')
         # camembert.eval()
         # expected_slice = roberta.model.forward(input_ids)[0][:, :3, :3].detach()

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




