





import json
import os
import shutil
import tempfile
import unittest

from transformers import BatchEncoding, CanineTokenizer
from transformers.testing_utils import require_tokenizers, require_torch
from transformers.tokenization_utils import AddedToken
from transformers.utils import cached_property

from ...test_tokenization_common import TokenizerTesterMixin
class   a_ (			snake_case__		,							unittest.TestCase      ):
			A__      :			int       	=  CanineTokenizer
			A__      :			int       	=  False

			def      lowerCAmelCase(   self   :  Any						):






							"""simple docstring"""
							super().setUp()
							snake_case   :					Dict    						=				CanineTokenizer()
							tokenizer.save_pretrained(self.tmpdirname						)

			@cached_property
			def      lowerCAmelCase(   self   :  Tuple						):






							"""simple docstring"""
							return CanineTokenizer.from_pretrained('''google/canine-s'''						)

			def      lowerCAmelCase(   self   :  List[str]     , **UpperCAmelCase__   :  Union[str, Any]						):






							"""simple docstring"""
							snake_case   :					int    						=				self.tokenizer_class.from_pretrained(self.tmpdirname     , **_UpperCamelCase						)
							snake_case   :					Any    						=				1_024
							return tokenizer

			@require_torch
			def      lowerCAmelCase(   self   :  Tuple						):






							"""simple docstring"""
							snake_case   :					List[str]    						=				self.canine_tokenizer
							snake_case   :					str    						=				['''Life is like a box of chocolates.''', '''You never know what you\'re gonna get.''']
							# fmt: off
							snake_case   :					int    						=				[57_344, 76, 105, 102, 101, 32, 105, 115, 32, 108, 105, 107, 101, 32, 97, 32, 98, 111, 120, 32, 111, 102, 32, 99, 104, 111, 99, 111, 108, 97, 116, 101, 115, 46, 57_345, 0, 0, 0, 0]
							# fmt: on
							snake_case   :					Dict    						=				tokenizer(_UpperCamelCase     , padding=_UpperCamelCase     , return_tensors='''pt'''						)
							self.assertIsInstance(_UpperCamelCase     , _UpperCamelCase						)

							snake_case   :					str    						=				list(batch.input_ids.numpy()[0]						)

							self.assertListEqual(_UpperCamelCase     , _UpperCamelCase						)

							self.assertEqual((2, 39)     , batch.input_ids.shape						)
							self.assertEqual((2, 39)     , batch.attention_mask.shape						)

			@require_torch
			def      lowerCAmelCase(   self   :  List[Any]						):






							"""simple docstring"""
							snake_case   :					Any    						=				self.canine_tokenizer
							snake_case   :					Optional[int]    						=				['''Once there was a man.''', '''He wrote a test in HuggingFace Tranformers.''']
							snake_case   :					List[str]    						=				tokenizer(_UpperCamelCase     , padding=_UpperCamelCase     , return_tensors='''pt'''						)
							# check if input_ids, attention_mask and token_type_ids are returned
							self.assertIn('''input_ids'''     , _UpperCamelCase						)
							self.assertIn('''attention_mask'''     , _UpperCamelCase						)
							self.assertIn('''token_type_ids'''     , _UpperCamelCase						)

			@require_torch
			def      lowerCAmelCase(   self   :  int						):






							"""simple docstring"""
							snake_case   :					str    						=				self.canine_tokenizer
							snake_case   :					List[str]    						=				[
							    '''What\'s the weater?''',
							    '''It\'s about 25 degrees.''',
							]
							snake_case   :					Any    						=				tokenizer(
							    text_target=_UpperCamelCase     , max_length=32     , padding='''max_length'''     , truncation=_UpperCamelCase     , return_tensors='''pt'''						)
							self.assertEqual(32     , targets['''input_ids'''].shape[1]						)

			def      lowerCAmelCase(   self   :  Dict						):






							"""simple docstring"""
							snake_case   :					Any    						=				self.get_tokenizers()
							for tokenizer in tokenizers:
											with self.subTest(F"{tokenizer.__class__.__name__}"						):
															self.assertNotEqual(tokenizer.model_max_length     , 42						)

        # Now let's start the test
							snake_case   :					Optional[Any]    						=				self.get_tokenizers()
							for tokenizer in tokenizers:
											with self.subTest(F"{tokenizer.__class__.__name__}"						):
															# Isolate this from the other tests because we save additional tokens/etc
															snake_case   :					List[str]    						=				tempfile.mkdtemp()

															snake_case   :					List[str]    						=				''' He is very happy, UNwant\u00E9d,running'''
															snake_case   :					Optional[Any]    						=				tokenizer.encode(_UpperCamelCase     , add_special_tokens=_UpperCamelCase						)
															tokenizer.save_pretrained(_UpperCamelCase						)

															snake_case   :					Any    						=				tokenizer.__class__.from_pretrained(_UpperCamelCase						)
															snake_case   :					Optional[int]    						=				after_tokenizer.encode(_UpperCamelCase     , add_special_tokens=_UpperCamelCase						)
															self.assertListEqual(_UpperCamelCase     , _UpperCamelCase						)

															shutil.rmtree(_UpperCamelCase						)

							snake_case   :					Tuple    						=				self.get_tokenizers(model_max_length=42						)
							for tokenizer in tokenizers:
											with self.subTest(F"{tokenizer.__class__.__name__}"						):
															# Isolate this from the other tests because we save additional tokens/etc
															snake_case   :					Tuple    						=				tempfile.mkdtemp()

															snake_case   :					str    						=				''' He is very happy, UNwant\u00E9d,running'''

															snake_case   :					Any    						=				tokenizer.additional_special_tokens

															# We can add a new special token for Canine as follows:
															snake_case   :					List[Any]    						=				chr(0XE_007						)
															additional_special_tokens.append(_UpperCamelCase						)
															tokenizer.add_special_tokens({'''additional_special_tokens''': additional_special_tokens}						)
															snake_case   :					List[Any]    						=				tokenizer.encode(_UpperCamelCase     , add_special_tokens=_UpperCamelCase						)
															tokenizer.save_pretrained(_UpperCamelCase						)

															snake_case   :					List[Any]    						=				tokenizer.__class__.from_pretrained(_UpperCamelCase						)
															snake_case   :					List[str]    						=				after_tokenizer.encode(_UpperCamelCase     , add_special_tokens=_UpperCamelCase						)
															self.assertListEqual(_UpperCamelCase     , _UpperCamelCase						)
															self.assertIn(_UpperCamelCase     , after_tokenizer.additional_special_tokens						)
															self.assertEqual(after_tokenizer.model_max_length     , 42						)

															snake_case   :					Tuple    						=				tokenizer.__class__.from_pretrained(_UpperCamelCase     , model_max_length=43						)
															self.assertEqual(tokenizer.model_max_length     , 43						)

															shutil.rmtree(_UpperCamelCase						)

			def      lowerCAmelCase(   self   :  Optional[Any]						):






							"""simple docstring"""
							snake_case   :					str    						=				self.get_tokenizers(do_lower_case=_UpperCamelCase						)
							for tokenizer in tokenizers:
											with self.subTest(F"{tokenizer.__class__.__name__}"						):
															snake_case						,						snake_case   :					Dict    						=				self.get_clean_sequence(_UpperCamelCase						)

															# a special token for Canine can be defined as follows:
															snake_case   :					Dict    						=				0XE_005
															snake_case   :					Optional[int]    						=				chr(_UpperCamelCase						)

															tokenizer.add_special_tokens({'''cls_token''': special_token}						)
															snake_case   :					int    						=				tokenizer.encode(_UpperCamelCase     , add_special_tokens=_UpperCamelCase						)
															self.assertEqual(len(_UpperCamelCase						)     , 1						)

															snake_case   :					List[str]    						=				tokenizer.decode(ids + encoded_special_token     , clean_up_tokenization_spaces=_UpperCamelCase						)
															snake_case   :					Optional[Any]    						=				tokenizer.encode(_UpperCamelCase     , add_special_tokens=_UpperCamelCase						)

															snake_case   :					List[str]    						=				tokenizer.encode(_UpperCamelCase     , add_special_tokens=_UpperCamelCase						)
															snake_case   :					List[str]    						=				tokenizer.encode(_UpperCamelCase     , add_special_tokens=_UpperCamelCase						)
															self.assertEqual(_UpperCamelCase     , input_encoded + special_token_id						)

															snake_case   :					Optional[int]    						=				tokenizer.decode(_UpperCamelCase     , skip_special_tokens=_UpperCamelCase						)
															self.assertTrue(special_token not in decoded						)

			def      lowerCAmelCase(   self   :  str						):






							"""simple docstring"""
							snake_case   :					Dict    						=				self.get_tokenizers(do_lower_case=_UpperCamelCase						)
							for tokenizer in tokenizers:
											with self.subTest(F"{tokenizer.__class__.__name__}"						):
															snake_case   :					Optional[Any]    						=				chr(0XE_005						)
															snake_case   :					int    						=				chr(0XE_006						)

															# `add_tokens` method stores special tokens only in `tokenizer.unique_no_split_tokens`. (in tokenization_utils.py)
															tokenizer.add_tokens([SPECIAL_TOKEN_1]     , special_tokens=_UpperCamelCase						)
															# `add_special_tokens` method stores special tokens in `tokenizer.additional_special_tokens`,
															# which also occur in `tokenizer.all_special_tokens`. (in tokenization_utils_base.py)
															tokenizer.add_special_tokens({'''additional_special_tokens''': [SPECIAL_TOKEN_2]}						)

															snake_case   :					str    						=				tokenizer.tokenize(_UpperCamelCase						)
															snake_case   :					Union[str, Any]    						=				tokenizer.tokenize(_UpperCamelCase						)

															self.assertEqual(len(_UpperCamelCase						)     , 1						)
															self.assertEqual(len(_UpperCamelCase						)     , 1						)
															self.assertEqual(token_a[0]     , _UpperCamelCase						)
															self.assertEqual(token_a[0]     , _UpperCamelCase						)

			@require_tokenizers
			def      lowerCAmelCase(   self   :  List[Any]						):






							"""simple docstring"""
							snake_case   :					Union[str, Any]    						=				self.get_tokenizers(do_lower_case=_UpperCamelCase						)
							for tokenizer in tokenizers:
											with self.subTest(F"{tokenizer.__class__.__name__}"						):
															# a special token for Canine can be defined as follows:
															snake_case   :					Dict    						=				0XE_006
															snake_case   :					Optional[int]    						=				chr(_UpperCamelCase						)

															snake_case   :					str    						=				AddedToken(_UpperCamelCase     , lstrip=_UpperCamelCase						)
															tokenizer.add_special_tokens({'''additional_special_tokens''': [new_token]}						)

															with tempfile.TemporaryDirectory() as tmp_dir_name:
																			tokenizer.save_pretrained(_UpperCamelCase						)
																			tokenizer.from_pretrained(_UpperCamelCase						)

			def      lowerCAmelCase(   self   :  str						):






							"""simple docstring"""
							snake_case   :					Any    						=				[]
							if self.test_slow_tokenizer:
											tokenizer_list.append((self.tokenizer_class, self.get_tokenizer())						)

							if self.test_rust_tokenizer:
											tokenizer_list.append((self.rust_tokenizer_class, self.get_rust_tokenizer())						)

							for tokenizer_class, tokenizer_utils in tokenizer_list:
											with tempfile.TemporaryDirectory() as tmp_dir:
															tokenizer_utils.save_pretrained(_UpperCamelCase						)

															with open(os.path.join(_UpperCamelCase     , '''special_tokens_map.json'''						)     , encoding='''utf-8'''						) as json_file:
																			snake_case   :					int    						=				json.load(_UpperCamelCase						)

															with open(os.path.join(_UpperCamelCase     , '''tokenizer_config.json'''						)     , encoding='''utf-8'''						) as json_file:
																			snake_case   :					Optional[Any]    						=				json.load(_UpperCamelCase						)

															# a special token for Canine can be defined as follows:
															snake_case   :					Optional[int]    						=				0XE_006
															snake_case   :					Tuple    						=				chr(_UpperCamelCase						)

															snake_case   :					Union[str, Any]    						=				[new_token_a]
															snake_case   :					Optional[int]    						=				[new_token_a]

															with open(os.path.join(_UpperCamelCase     , '''special_tokens_map.json'''						)     , '''w'''     , encoding='''utf-8'''						) as outfile:
																			json.dump(_UpperCamelCase     , _UpperCamelCase						)
															with open(os.path.join(_UpperCamelCase     , '''tokenizer_config.json'''						)     , '''w'''     , encoding='''utf-8'''						) as outfile:
																			json.dump(_UpperCamelCase     , _UpperCamelCase						)

															# the following checks allow us to verify that our test works as expected, i.e. that the tokenizer takes
															# into account the new value of additional_special_tokens given in the "tokenizer_config.json" and
															# "special_tokens_map.json" files
															snake_case   :					Optional[Any]    						=				tokenizer_class.from_pretrained(_UpperCamelCase     , extra_ids=0						)
															self.assertIn(_UpperCamelCase     , tokenizer_without_change_in_init.additional_special_tokens						)
															# self.assertIn("an_additional_special_token",tokenizer_without_change_in_init.get_vocab()) # ByT5Tokenization no vocab
															self.assertEqual(
															    [new_token_a]     , tokenizer_without_change_in_init.convert_ids_to_tokens(
															        tokenizer_without_change_in_init.convert_tokens_to_ids([new_token_a]						)						)     , )

															snake_case   :					Dict    						=				0XE_007
															snake_case   :					int    						=				chr(_UpperCamelCase						)
															# Now we test that we can change the value of additional_special_tokens in the from_pretrained
															snake_case   :					Tuple    						=				[AddedToken(_UpperCamelCase     , lstrip=_UpperCamelCase						)]
															snake_case   :					int    						=				tokenizer_class.from_pretrained(
															    _UpperCamelCase     , additional_special_tokens=_UpperCamelCase     , extra_ids=0						)

															self.assertIn(_UpperCamelCase     , tokenizer.additional_special_tokens						)
															# self.assertIn(new_token_2,tokenizer.get_vocab()) # ByT5Tokenization no vocab
															self.assertEqual(
															    [new_token_a]     , tokenizer.convert_ids_to_tokens(tokenizer.convert_tokens_to_ids([new_token_a]						)						)						)

			@require_tokenizers
			def      lowerCAmelCase(   self   :  Union[str, Any]						):






							"""simple docstring"""
							snake_case   :					Optional[int]    						=				self.get_tokenizers(do_lower_case=_UpperCamelCase						)
							for tokenizer in tokenizers:
											with self.subTest(F"{tokenizer.__class__.__name__}"						):
															snake_case   :					List[Any]    						=				'''hello world'''
															if self.space_between_special_tokens:
																			snake_case   :					List[Any]    						=				'''[CLS] hello world [SEP]'''
															else:
																			snake_case   :					Optional[Any]    						=				input
															snake_case   :					Dict    						=				tokenizer.encode(_UpperCamelCase     , add_special_tokens=_UpperCamelCase						)
															snake_case   :					List[Any]    						=				tokenizer.decode(_UpperCamelCase     , spaces_between_special_tokens=self.space_between_special_tokens						)
															self.assertIn(_UpperCamelCase     , [output, output.lower()]						)

			def      lowerCAmelCase(   self   :  Tuple						):






							"""simple docstring"""
							snake_case   :					Any    						=				self.get_tokenizers()
							for tokenizer in tokenizers:
											with self.subTest(F"{tokenizer.__class__.__name__}"						):
															snake_case   :					Optional[int]    						=				[
															    '''bos_token''',
															    '''eos_token''',
															    '''unk_token''',
															    '''sep_token''',
															    '''pad_token''',
															    '''cls_token''',
															    '''mask_token''',
															]

							snake_case   :					List[str]    						=				'''a'''
							snake_case   :					Dict    						=				ord(_UpperCamelCase						)

							for attr in attributes_list:
											setattr(_UpperCamelCase     , attr + '''_id'''     , _UpperCamelCase						)
											self.assertEqual(getattr(_UpperCamelCase     , _UpperCamelCase						)     , _UpperCamelCase						)
											self.assertEqual(getattr(_UpperCamelCase     , attr + '''_id'''						)     , _UpperCamelCase						)

											setattr(_UpperCamelCase     , attr + '''_id'''     , _UpperCamelCase						)
											self.assertEqual(getattr(_UpperCamelCase     , _UpperCamelCase						)     , _UpperCamelCase						)
											self.assertEqual(getattr(_UpperCamelCase     , attr + '''_id'''						)     , _UpperCamelCase						)

							setattr(_UpperCamelCase     , '''additional_special_tokens_ids'''     , []						)
							self.assertListEqual(getattr(_UpperCamelCase     , '''additional_special_tokens'''						)     , []						)
							self.assertListEqual(getattr(_UpperCamelCase     , '''additional_special_tokens_ids'''						)     , []						)

							snake_case   :					List[Any]    						=				0XE_006
							snake_case   :					List[str]    						=				chr(_UpperCamelCase						)
							setattr(_UpperCamelCase     , '''additional_special_tokens_ids'''     , [additional_special_token_id]						)
							self.assertListEqual(getattr(_UpperCamelCase     , '''additional_special_tokens'''						)     , [additional_special_token]						)
							self.assertListEqual(getattr(_UpperCamelCase     , '''additional_special_tokens_ids'''						)     , [additional_special_token_id]						)

			def      lowerCAmelCase(   self   :  List[str]						):






							"""simple docstring"""
							pass

			def      lowerCAmelCase(   self   :  int						):






							"""simple docstring"""
							pass

			def      lowerCAmelCase(   self   :  Dict						):






							"""simple docstring"""
							pass

			def      lowerCAmelCase(   self   :  Union[str, Any]						):






							"""simple docstring"""
							pass

			def      lowerCAmelCase(   self   :  Optional[Any]						):






							"""simple docstring"""
							pass

			def      lowerCAmelCase(   self   :  Union[str, Any]						):






							"""simple docstring"""
							pass

			def      lowerCAmelCase(   self   :  List[Any]						):






							"""simple docstring"""
							pass



			def      lowerCAmelCase(   self   :  Optional[int]						):






							"""simple docstring"""
							pass



import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs


if is_torch_available():
    import torch

if is_vision_available():
    from PIL import Image

    from transformers import VivitImageProcessor

class     __snake_case    (				unittest.TestCase  ):
       """simple docstring"""







       def __init__(		self      , _UpperCamelCase      , _UpperCamelCase=7      , _UpperCamelCase=3      , _UpperCamelCase=10      , _UpperCamelCase=18      , _UpperCamelCase=30      , _UpperCamelCase=4_00      , _UpperCamelCase=True      , _UpperCamelCase=None      , _UpperCamelCase=True      , _UpperCamelCase=[0.5, 0.5, 0.5]      , _UpperCamelCase=[0.5, 0.5, 0.5]      , _UpperCamelCase=None      , )      ->							str:






              """simple docstring"""


              __snake_case       	=							size if size is not None else {"""shortest_edge""": 18}
              __snake_case       	=							crop_size if crop_size is not None else {"""height""": 18, """width""": 18}

              __snake_case       	=							parent
              __snake_case       	=							batch_size
              __snake_case       	=							num_channels
              __snake_case       	=							num_frames
              __snake_case       	=							image_size
              __snake_case       	=							min_resolution
              __snake_case       	=							max_resolution
              __snake_case       	=							do_resize
              __snake_case       	=							size
              __snake_case       	=							do_normalize
              __snake_case       	=							image_mean
              __snake_case       	=							image_std
              __snake_case       	=							crop_size






       def 			a		(		self   )      ->							Optional[Any]:






              """simple docstring"""


              return {
                  "image_mean": self.image_mean,
                  "image_std": self.image_std,
                  "do_normalize": self.do_normalize,
                  "do_resize": self.do_resize,
                  "size": self.size,
                  "crop_size": self.crop_size,
              }






@require_torch
@require_vision
class     __snake_case    (				snake_case__			,	unittest.TestCase  ):
       """simple docstring"""







       __SCREAMING_SNAKE_CASE				    =							VivitImageProcessor if is_vision_available() else None


       def 			a		(		self   )      ->							int:






              """simple docstring"""


              __snake_case       	=							VivitImageProcessingTester(self   )


       @property
       def 			a		(		self   )      ->							str:






              """simple docstring"""


              return self.image_processor_tester.prepare_image_processor_dict()


       def 			a		(		self   )      ->							List[Any]:






              """simple docstring"""


              __snake_case       	=							self.image_processing_class(**self.image_processor_dict   )
              self.assertTrue(hasattr(_UpperCamelCase      , """image_mean"""   )   )
              self.assertTrue(hasattr(_UpperCamelCase      , """image_std"""   )   )
              self.assertTrue(hasattr(_UpperCamelCase      , """do_normalize"""   )   )
              self.assertTrue(hasattr(_UpperCamelCase      , """do_resize"""   )   )
              self.assertTrue(hasattr(_UpperCamelCase      , """do_center_crop"""   )   )
              self.assertTrue(hasattr(_UpperCamelCase      , """size"""   )   )


       def 			a		(		self   )      ->							str:






              """simple docstring"""


              __snake_case       	=							self.image_processing_class.from_dict(self.image_processor_dict   )
              self.assertEqual(image_processor.size      , {"""shortest_edge""": 18}   )
              self.assertEqual(image_processor.crop_size      , {"""height""": 18, """width""": 18}   )

              __snake_case       	=							self.image_processing_class.from_dict(self.image_processor_dict      , size=42      , crop_size=84   )
              self.assertEqual(image_processor.size      , {"""shortest_edge""": 42}   )
              self.assertEqual(image_processor.crop_size      , {"""height""": 84, """width""": 84}   )


       def 			a		(		self   )      ->							List[str]:






              """simple docstring"""


              __snake_case       	=							self.image_processing_class(**self.image_processor_dict   )
              # create random PIL videos
              __snake_case       	=							prepare_video_inputs(self.image_processor_tester      , equal_resolution=_UpperCamelCase   )
              for video in video_inputs:
                     self.assertIsInstance(_UpperCamelCase      , _UpperCamelCase   )
                     self.assertIsInstance(video[0]      , Image.Image   )

              # Test not batched input
              __snake_case       	=							image_processing(video_inputs[0]      , return_tensors="""pt"""   ).pixel_values
              self.assertEqual(
                  encoded_videos.shape      , (
                      1,
                      self.image_processor_tester.num_frames,
                      self.image_processor_tester.num_channels,
                      self.image_processor_tester.crop_size["""height"""],
                      self.image_processor_tester.crop_size["""width"""],
                  )      , )

              # Test batched
              __snake_case       	=							image_processing(_UpperCamelCase      , return_tensors="""pt"""   ).pixel_values
              self.assertEqual(
                  encoded_videos.shape      , (
                      self.image_processor_tester.batch_size,
                      self.image_processor_tester.num_frames,
                      self.image_processor_tester.num_channels,
                      self.image_processor_tester.crop_size["""height"""],
                      self.image_processor_tester.crop_size["""width"""],
                  )      , )


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






              """simple docstring"""


              __snake_case       	=							self.image_processing_class(**self.image_processor_dict   )
              # create random numpy tensors
              __snake_case       	=							prepare_video_inputs(self.image_processor_tester      , equal_resolution=_UpperCamelCase      , numpify=_UpperCamelCase   )
              for video in video_inputs:
                     self.assertIsInstance(_UpperCamelCase      , _UpperCamelCase   )
                     self.assertIsInstance(video[0]      , np.ndarray   )

              # Test not batched input
              __snake_case       	=							image_processing(video_inputs[0]      , return_tensors="""pt"""   ).pixel_values
              self.assertEqual(
                  encoded_videos.shape      , (
                      1,
                      self.image_processor_tester.num_frames,
                      self.image_processor_tester.num_channels,
                      self.image_processor_tester.crop_size["""height"""],
                      self.image_processor_tester.crop_size["""width"""],
                  )      , )

              # Test batched
              __snake_case       	=							image_processing(_UpperCamelCase      , return_tensors="""pt"""   ).pixel_values
              self.assertEqual(
                  encoded_videos.shape      , (
                      self.image_processor_tester.batch_size,
                      self.image_processor_tester.num_frames,
                      self.image_processor_tester.num_channels,
                      self.image_processor_tester.crop_size["""height"""],
                      self.image_processor_tester.crop_size["""width"""],
                  )      , )






       def 			a		(		self   )      ->							List[Any]:






              """simple docstring"""


              __snake_case       	=							self.image_processing_class(**self.image_processor_dict   )
              # create random PyTorch tensors
              __snake_case       	=							prepare_video_inputs(self.image_processor_tester      , equal_resolution=_UpperCamelCase      , torchify=_UpperCamelCase   )
              for video in video_inputs:
                     self.assertIsInstance(_UpperCamelCase      , _UpperCamelCase   )
                     self.assertIsInstance(video[0]      , torch.Tensor   )

              # Test not batched input
              __snake_case       	=							image_processing(video_inputs[0]      , return_tensors="""pt"""   ).pixel_values
              self.assertEqual(
                  encoded_videos.shape      , (
                      1,
                      self.image_processor_tester.num_frames,
                      self.image_processor_tester.num_channels,
                      self.image_processor_tester.crop_size["""height"""],
                      self.image_processor_tester.crop_size["""width"""],
                  )      , )

              # Test batched
              __snake_case       	=							image_processing(_UpperCamelCase      , return_tensors="""pt"""   ).pixel_values
              self.assertEqual(
                  encoded_videos.shape      , (
                      self.image_processor_tester.batch_size,
                      self.image_processor_tester.num_frames,
                      self.image_processor_tester.num_channels,
                      self.image_processor_tester.crop_size["""height"""],
                      self.image_processor_tester.crop_size["""width"""],
                  )      , )

