





"""simple docstring"""


import os
import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
      import torch

      from transformers import GPTaLMHeadModel







@require_torch
@require_sentencepiece
@require_tokenizers
class 	__a   (  unittest.TestCase		):



     @slow
     @unittest.skip('Model is not available.'   )
     def 						snake_case_			(       self   ):
            _lowerCamelCase    	=					'nvidia/megatron-gpt2-345m/'
            if "MYDIR" in os.environ:
                   _lowerCamelCase    	=					os.path.join(os.environ['MYDIR']					,     a__   )
            _lowerCamelCase    	=					GPTaLMHeadModel.from_pretrained(a__   )
            model.to(a__   )
            model.half()

            _lowerCamelCase    	=					torch.tensor(
                [[1_01, 71_10, 10_05, 10_56, 20_23, 1_13_33, 1_74_13, 10_29, 1_02]]					,     device=a__					,     dtype=torch.long					,     )

            with torch.no_grad():
                   _lowerCamelCase    	=					model(a__   ).logits

            _lowerCamelCase    	=					torch.Size((1, 9, 5_02_57)   )
            self.assertEqual(output.shape					,     a__   )

            _lowerCamelCase    	=					torch.tensor(
                [
                    4.9414,
                    -0.2920,
                    -1.2148,
                    -4.0273,
                    -0.5161,
                    -5.2109,
                    -1.2412,
                    -1.8301,
                    -1.7734,
                    -4.7148,
                    -0.2317,
                    -1.0811,
                    -2.1777,
                    0.4141,
                    -3.7969,
                    -4.0586,
                    -2.5332,
                    -3.3809,
                    4.3867,
                ]					,     device=a__					,     dtype=torch.half					,     )

            for i in range(19   ):
                   _lowerCamelCase	,	_lowerCamelCase    	=					8 * i // 17, 27_92 * i  # along the diagonal
                   _lowerCamelCase	,	_lowerCamelCase    	=					output[0, r, c], expected_diag[i]
                   _lowerCamelCase    	=					F'row={r} col={c} computed={computed} expected={expected}'
                   self.assertAlmostEqual(a__					,     a__					,     delta=1e-4					,     msg=a__   )













"""simple docstring"""


A_     :      Dict								=1_0**8





def SCREAMING_SNAKE_CASE_   (       snake_case   :					int		)->		bool:
       if n % 10 == 0:
              return False
       _lowerCamelCase    	=					str(snake_case		)
       return s == s[::-1]





def SCREAMING_SNAKE_CASE_   (       )->		int:
       _lowerCamelCase    	=					set()
       _lowerCamelCase    	=					1
       _lowerCamelCase    	=					5
       while sum_squares < LIMIT:
              _lowerCamelCase    	=					first_square + 1
              while sum_squares < LIMIT:
                     if is_palindrome(snake_case		):
                            answer.add(snake_case		)
                     last_square += 1
                     sum_squares += last_square**2
              first_square += 1
              _lowerCamelCase    	=					first_square**2 + (first_square + 1) ** 2

       return sum(snake_case		)


if __name__ == "__main__":
      print(solution())






