


'''simple docstring'''
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     _lowerCamelCase       (     unittest.TestCase					):




 '''simple docstring'''


 def 			snake_case__ (   self    ):

  """simple docstring"""







  __A	:		List[str]	  =      'ZinengTang/tvlt-base'
  __A	:		List[str]	  =      tempfile.mkdtemp()


 def 			snake_case__ (   self   ,   **__lowercase    ):

  """simple docstring"""







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


 def 			snake_case__ (   self   ,   **__lowercase    ):

  """simple docstring"""







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


 def 			snake_case__ (   self    ):

  """simple docstring"""







  shutil.rmtree(self.tmpdirname    )


 def 			snake_case__ (   self    ):

  """simple docstring"""







  __A	:		List[str]	  =      self.get_image_processor()
  __A	:		List[Any]	  =      self.get_feature_extractor()

  __A	:		Any	  =      TvltProcessor(image_processor=__lowercase   ,   feature_extractor=__lowercase    )
  processor.save_pretrained(self.tmpdirname    )
  __A	:		Dict	  =      TvltProcessor.from_pretrained(self.tmpdirname    )

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


 def 			snake_case__ (   self    ):

  """simple docstring"""







  __A	:		List[Any]	  =      self.get_image_processor()
  __A	:		int	  =      self.get_feature_extractor()

  __A	:		Union[str, Any]	  =      TvltProcessor(image_processor=__lowercase   ,   feature_extractor=__lowercase    )

  __A	:		List[Any]	  =      np.ones([12_000]    )

  __A	:		Optional[int]	  =      feature_extractor(__lowercase   ,   return_tensors='np'    )
  __A	:		Tuple	  =      processor(audio=__lowercase   ,   return_tensors='np'    )

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


 def 			snake_case__ (   self    ):

  """simple docstring"""







  __A	:		Tuple	  =      self.get_image_processor()
  __A	:		Any	  =      self.get_feature_extractor()

  __A	:		Union[str, Any]	  =      TvltProcessor(image_processor=__lowercase   ,   feature_extractor=__lowercase    )

  __A	:		List[str]	  =      np.ones([3, 224, 224]    )

  __A	:		List[Any]	  =      image_processor(__lowercase   ,   return_tensors='np'    )
  __A	:		Any	  =      processor(images=__lowercase   ,   return_tensors='np'    )

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


 def 			snake_case__ (   self    ):

  """simple docstring"""







  __A	:		List[Any]	  =      self.get_image_processor()
  __A	:		List[str]	  =      self.get_feature_extractor()

  __A	:		Tuple	  =      TvltProcessor(image_processor=__lowercase   ,   feature_extractor=__lowercase    )

  __A	:		Dict	  =      np.ones([12_000]    )
  __A	:		Dict	  =      np.ones([3, 224, 224]    )

  __A	:		Any	  =      processor(audio=__lowercase   ,   images=__lowercase    )

  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(__lowercase    ):
   processor()







 def 			snake_case__ (   self    ):

  """simple docstring"""







  __A	:		List[Any]	  =      self.get_image_processor()
  __A	:		str	  =      self.get_feature_extractor()

  __A	:		str	  =      TvltProcessor(image_processor=__lowercase   ,   feature_extractor=__lowercase    )

  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'''
from math import ceil


def       _lowercase							(					UpperCamelCase__							:       int = 1001      ):
 __A	:		int	  =      1

 for i in range(1,					int(ceil(n / 2.0      )      )      ):
  __A	:		Any	  =      2 * i + 1
  __A	:		List[str]	  =      2 * i
  __A	:		str	  =      total + 4 * odd**2 - 6 * even

 return total


if __name__ == "__main__":
 import sys

 if len(sys.argv) == 1:
  print(solution())
 else:
  try:
   UpperCAmelCase_			:  int										=   int(sys.argv[1])
   print(solution(n))
  except ValueError:
   print('Invalid entry - please enter a number')






