





import shutil
import tempfile
import unittest

import numpy as np
import pytest

from transformers import is_speech_available, is_vision_available
from transformers.testing_utils import require_torch


if is_vision_available():
    from transformers import TvltImageProcessor

if is_speech_available():
    from transformers import TvltFeatureExtractor

from transformers import TvltProcessor

@require_torch
class 		SCREAMING_SNAKE_CASE__				(       unittest.TestCase  ):


      def    a (self       :      Optional[int]      ):





         """simple docstring"""



         __snake_case							       =   '''ZinengTang/tvlt-base'''
         __snake_case							       =   tempfile.mkdtemp()


      def    a (self       :      str				,			**a__       :      Union[str, Any]      ):





         """simple docstring"""



         return TvltImageProcessor.from_pretrained(self.checkpoint				,			**a__      )


      def    a (self       :      List[Any]				,			**a__       :      List[Any]      ):





         """simple docstring"""



         return TvltFeatureExtractor.from_pretrained(self.checkpoint				,			**a__      )


      def    a (self       :      Dict      ):





         """simple docstring"""



         shutil.rmtree(self.tmpdirname      )


      def    a (self       :      Optional[int]      ):





         """simple docstring"""



         __snake_case							       =   self.get_image_processor()
         __snake_case							       =   self.get_feature_extractor()

         __snake_case							       =   TvltProcessor(image_processor=a__				,			feature_extractor=a__      )
         processor.save_pretrained(self.tmpdirname      )
         __snake_case							       =   TvltProcessor.from_pretrained(self.tmpdirname      )

         self.assertIsInstance(processor.feature_extractor				,			a__      )
         self.assertIsInstance(processor.image_processor				,			a__      )


      def    a (self       :      Any      ):





         """simple docstring"""



         __snake_case							       =   self.get_image_processor()
         __snake_case							       =   self.get_feature_extractor()

         __snake_case							       =   TvltProcessor(image_processor=a__				,			feature_extractor=a__      )

         __snake_case							       =   np.ones([1_2000]      )

         __snake_case							       =   feature_extractor(a__				,			return_tensors='''np'''      )
         __snake_case							       =   processor(audio=a__				,			return_tensors='''np'''      )

         for key in audio_dict.keys():
            self.assertAlmostEqual(audio_dict[key].sum()				,			input_processor[key].sum()				,			delta=1E-2      )


      def    a (self       :      Dict      ):





         """simple docstring"""



         __snake_case							       =   self.get_image_processor()
         __snake_case							       =   self.get_feature_extractor()

         __snake_case							       =   TvltProcessor(image_processor=a__				,			feature_extractor=a__      )

         __snake_case							       =   np.ones([3, 224, 224]      )

         __snake_case							       =   image_processor(a__				,			return_tensors='''np'''      )
         __snake_case							       =   processor(images=a__				,			return_tensors='''np'''      )

         for key in image_dict.keys():
            self.assertAlmostEqual(image_dict[key].sum()				,			input_processor[key].sum()				,			delta=1E-2      )


      def    a (self       :      List[Any]      ):





         """simple docstring"""



         __snake_case							       =   self.get_image_processor()
         __snake_case							       =   self.get_feature_extractor()

         __snake_case							       =   TvltProcessor(image_processor=a__				,			feature_extractor=a__      )

         __snake_case							       =   np.ones([1_2000]      )
         __snake_case							       =   np.ones([3, 224, 224]      )

         __snake_case							       =   processor(audio=a__				,			images=a__      )

         self.assertListEqual(list(inputs.keys()      )				,			['''audio_values''', '''audio_mask''', '''pixel_values''', '''pixel_mask''']      )

         # test if it raises when no input is passed
         with pytest.raises(a__      ):
            processor()


      def    a (self       :      Dict      ):





         """simple docstring"""



         __snake_case							       =   self.get_image_processor()
         __snake_case							       =   self.get_feature_extractor()

         __snake_case							       =   TvltProcessor(image_processor=a__				,			feature_extractor=a__      )

         self.assertListEqual(
             processor.model_input_names				,			image_processor.model_input_names + feature_extractor.model_input_names				,			msg='''`processor` and `image_processor`+`feature_extractor` model input names do not match'''				,			)



"""simple docstring"""



def 					_UpperCAmelCase      ( __lowerCamelCase   :       int = 1_00_00_00		)     ->					int:
  _snake_case					     =       limit + 1
  _snake_case					     =       [0] * limit
  for first_term in range(1 ,					__lowerCamelCase		):
    for n in range(__lowerCamelCase ,					__lowerCamelCase ,					__lowerCamelCase		):
      _snake_case					     =       first_term + n / first_term
      if common_difference % 4:  # d must be divisble by 4
        continue
      else:
        common_difference /= 4
        if (
            first_term > common_difference
            and first_term < 4 * common_difference
        ):  # since x,y,z are positive integers
          frequency[n] += 1  # so z>0 and a>d ,also 4d<a

  _snake_case					     =       sum(1 for x in frequency[1:limit] if x == 10		)

  return count


if __name__ == "__main__":
 print(F"{solution() = }")



