



'''simple docstring'''





import tempfile
import unittest

import numpy as np

import transformers
from transformers import GPTaTokenizer, GPTNeoConfig, is_flax_available, is_torch_available
from transformers.testing_utils import is_pt_flax_cross_test, require_flax, slow

from ...generation.test_flax_utils import FlaxGenerationTesterMixin
from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
    import jax
    import jax.numpy as jnp

    from transformers.modeling_flax_pytorch_utils import (
        convert_pytorch_state_dict_to_flax,
        load_flax_weights_in_pytorch_model,
    )
    from transformers.models.gpt_neo.modeling_flax_gpt_neo import FlaxGPTNeoForCausalLM, FlaxGPTNeoModel

if is_torch_available():
    import torch



class       snake_case__		:
 def __init__(					self		:				List[str]	,			__a		:				Any	,			__a		:				Union[str, Any]=14	,			__a		:				Optional[Any]=7	,			__a		:				Tuple=True	,			__a		:				int=True	,			__a		:				Dict=False	,			__a		:				List[Any]=True	,			__a		:				Optional[int]=99	,			__a		:				Tuple=32	,			__a		:				Any=4	,			__a		:				List[Any]=4	,			__a		:				int=[[["global", "local"], 2]]	,			__a		:				Optional[Any]=37	,			__a		:				Optional[Any]="gelu"	,			__a		:				Dict=0.1	,			__a		:				List[Any]=0.1	,			__a		:				Union[str, Any]=512	,			__a		:				int=7	,			__a		:				Any=0.0_2	,			)	->					Optional[Any]:







       '''simple docstring'''
       __snake_case      :					Tuple						=  parent
       __snake_case      :					Union[str, Any]						=  batch_size
       __snake_case      :					Any						=  seq_length
       __snake_case      :					List[Any]						=  is_training
       __snake_case      :					Dict						=  use_input_mask
       __snake_case      :					List[Any]						=  use_token_type_ids
       __snake_case      :					Any						=  use_labels
       __snake_case      :					List[Any]						=  vocab_size
       __snake_case      :					List[str]						=  hidden_size
       __snake_case      :					Optional[int]						=  num_hidden_layers
       __snake_case      :					Union[str, Any]						=  num_attention_heads
       __snake_case      :					Tuple						=  attention_types
       __snake_case      :					str						=  intermediate_size
       __snake_case      :					Optional[int]						=  hidden_act
       __snake_case      :					int						=  hidden_dropout_prob
       __snake_case      :					Any						=  attention_probs_dropout_prob
       __snake_case      :					Any						=  max_position_embeddings
       __snake_case      :					Union[str, Any]						=  window_size
       __snake_case      :					int						=  initializer_range
       __snake_case      :					Any						=  None
       __snake_case      :					Optional[Any]						=  vocab_size - 1
       __snake_case      :					Optional[Any]						=  vocab_size - 1
       __snake_case      :					int						=  vocab_size - 1
 def A_					(					self		:				Union[str, Any]   )	->					Dict:







       '''simple docstring'''
       __snake_case      :					List[Any]						=  ids_tensor([self.batch_size, self.seq_length]	,			self.vocab_size   )

       __snake_case      :					Tuple						=  None
       if self.use_input_mask:
             __snake_case      :					List[Any]						=  random_attention_mask([self.batch_size, self.seq_length]   )

       __snake_case      :					Optional[int]						=  GPTNeoConfig(
           vocab_size=self.vocab_size	,			hidden_size=self.hidden_size	,			num_layers=self.num_hidden_layers	,			num_heads=self.num_attention_heads	,			max_position_embeddings=self.max_position_embeddings	,			use_cache=__a	,			bos_token_id=self.bos_token_id	,			eos_token_id=self.eos_token_id	,			pad_token_id=self.pad_token_id	,			window_size=self.window_size	,			attention_types=self.attention_types	,			)

       return (config, input_ids, input_mask)
 def A_					(					self		:				Tuple   )	->					str:







       '''simple docstring'''
       __snake_case      :					Optional[int]						=  self.prepare_config_and_inputs()
       __snake_case				,			__snake_case				,			__snake_case      :					str						=  config_and_inputs
       __snake_case      :					int						=  {'input_ids': input_ids, 'attention_mask': attention_mask}
       return config, inputs_dict
 def A_					(					self		:				List[Any]	,			__a		:				int	,			__a		:				Union[str, Any]	,			__a		:				Optional[int]	,			__a		:				Optional[int]   )	->					List[Any]:







       '''simple docstring'''
       __snake_case      :					List[Any]						=  20
       __snake_case      :					str						=  model_class_name(__a   )

       __snake_case      :					List[Any]						=  model.init_cache(input_ids.shape[0]	,			__a   )
       __snake_case      :					List[Any]						=  jnp.ones((input_ids.shape[0], max_decoder_length)	,			dtype='i4'   )

       __snake_case      :					List[str]						=  jnp.broadcast_to(
           jnp.arange(input_ids.shape[-1] - 1   )[None, :]	,			(input_ids.shape[0], input_ids.shape[-1] - 1)   )
       __snake_case      :					Tuple						=  model(
           input_ids[:, :-1]	,			attention_mask=__a	,			past_key_values=__a	,			position_ids=__a	,			)

       __snake_case      :					List[str]						=  jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]]	,			dtype='i4'   )
       __snake_case      :					str						=  model(
           input_ids[:, -1:]	,			attention_mask=__a	,			past_key_values=outputs_cache.past_key_values	,			position_ids=__a	,			)

       __snake_case      :					Any						=  model(__a   )

       __snake_case      :					Union[str, Any]						=  np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])   )   )
       self.parent.assertTrue(diff < 1e-3	,			msg=f'''Max diff is {diff}'''   )





 def A_					(					self		:				Optional[Any]	,			__a		:				Dict	,			__a		:				Dict	,			__a		:				Optional[Any]	,			__a		:				Tuple   )	->					Any:







       '''simple docstring'''
       __snake_case      :					Dict						=  20
       __snake_case      :					Dict						=  model_class_name(__a   )

       __snake_case      :					Any						=  jnp.concatenate(
           [attention_mask, jnp.zeros((attention_mask.shape[0], max_decoder_length - attention_mask.shape[1])   )]	,			axis=-1	,			)

       __snake_case      :					int						=  model.init_cache(input_ids.shape[0]	,			__a   )
       __snake_case      :					List[str]						=  jnp.broadcast_to(
           jnp.arange(input_ids.shape[-1] - 1   )[None, :]	,			(input_ids.shape[0], input_ids.shape[-1] - 1)   )

       __snake_case      :					List[str]						=  model(
           input_ids[:, :-1]	,			attention_mask=__a	,			past_key_values=__a	,			position_ids=__a	,			)
       __snake_case      :					Dict						=  jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]]	,			dtype='i4'   )
       __snake_case      :					int						=  model(
           input_ids[:, -1:]	,			past_key_values=outputs_cache.past_key_values	,			attention_mask=__a	,			position_ids=__a	,			)

       __snake_case      :					str						=  model(__a	,			attention_mask=__a   )

       __snake_case      :					Optional[int]						=  np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])   )   )
       self.parent.assertTrue(diff < 1e-3	,			msg=f'''Max diff is {diff}'''   )



@require_flax
class       snake_case__		(  _SCREAMING_SNAKE_CASE   ,			_SCREAMING_SNAKE_CASE   ,			unittest.TestCase							):
 A__							=      (FlaxGPTNeoModel, FlaxGPTNeoForCausalLM) if is_flax_available() else ()
 A__							=      (FlaxGPTNeoForCausalLM,) if is_flax_available() else ()
 def A_					(					self		:				Dict   )	->					List[str]:







       '''simple docstring'''
       __snake_case      :					Optional[int]						=  FlaxGPTNeoModelTester(self   )
 def A_					(					self		:				int   )	->					Optional[Any]:







       '''simple docstring'''
       for model_class_name in self.all_model_classes:
             __snake_case				,			__snake_case				,			__snake_case      :					List[str]						=  self.model_tester.prepare_config_and_inputs()
             self.model_tester.check_use_cache_forward(__a	,			__a	,			__a	,			__a   )
 def A_					(					self		:				List[str]   )	->					Dict:







       '''simple docstring'''
       for model_class_name in self.all_model_classes:
             __snake_case				,			__snake_case				,			__snake_case      :					Optional[Any]						=  self.model_tester.prepare_config_and_inputs()
             self.model_tester.check_use_cache_forward_with_attn_mask(
                 __a	,			__a	,			__a	,			__a   )
 @slow
 def A_					(					self		:				Union[str, Any]   )	->					Union[str, Any]:







       '''simple docstring'''
       __snake_case      :					Optional[Any]						=  GPTaTokenizer.from_pretrained('gpt2'	,			pad_token='<|endoftext|>'	,			padding_side='left'   )
       __snake_case      :					str						=  tokenizer(['Hello this is a long string', 'Hey']	,			return_tensors='np'	,			padding=__a	,			truncation=__a   )

       __snake_case      :					Optional[int]						=  FlaxGPTNeoForCausalLM.from_pretrained('EleutherAI/gpt-neo-125M'   )
       __snake_case      :					Tuple						=  False
       __snake_case      :					List[str]						=  model.config.eos_token_id

       __snake_case      :					int						=  jax.jit(model.generate   )

       __snake_case      :					Tuple						=  jit_generate(
           inputs['input_ids']	,			attention_mask=inputs['attention_mask']	,			pad_token_id=tokenizer.pad_token_id   ).sequences

       __snake_case      :					Optional[int]						=  tokenizer.batch_decode(__a	,			skip_special_tokens=__a   )

       __snake_case      :					Dict						=  [
           'Hello this is a long string of text.\n\nI\'m trying to get the text of the',
           'Hey, I\'m a little late to the party. I\'m going to',
       ]

       self.assertListEqual(__a	,			__a   )
 @is_pt_flax_cross_test
 def A_					(					self		:				Dict   )	->					str:







       '''simple docstring'''
       __snake_case				,			__snake_case      :					str						=  self.model_tester.prepare_config_and_inputs_for_common()

       for model_class in self.all_model_classes:
             with self.subTest(model_class.__name__   ):
                   # prepare inputs
                   __snake_case      :					Tuple						=  self._prepare_for_class(__a	,			__a   )
                   __snake_case      :					Optional[Any]						=  {k: torch.tensor(v.tolist()   ) for k, v in prepared_inputs_dict.items()}

                   # load corresponding PyTorch class
                   __snake_case      :					Optional[Any]						=  model_class.__name__[4:]  # Skip the "Flax" at the beginning
                   __snake_case      :					Optional[Any]						=  getattr(__a	,			__a   )

                   __snake_case				,			__snake_case      :					Optional[Any]						=  pt_inputs['input_ids'].shape
                   __snake_case      :					Optional[int]						=  np.random.randint(0	,			seq_length - 1	,			size=(batch_size,)   )
                   for batch_idx, start_index in enumerate(__a   ):
                         __snake_case      :					List[Any]						=  0
                         __snake_case      :					Union[str, Any]						=  1
                         __snake_case      :					Optional[int]						=  0
                         __snake_case      :					List[str]						=  1
                   __snake_case      :					Union[str, Any]						=  pt_model_class(__a   ).eval()
                   __snake_case      :					Optional[int]						=  model_class(__a	,			dtype=jnp.floataa   )

                   __snake_case      :					List[str]						=  convert_pytorch_state_dict_to_flax(pt_model.state_dict()	,			__a   )
                   __snake_case      :					List[Any]						=  fx_state

                   with torch.no_grad():
                         __snake_case      :					Any						=  pt_model(**__a   ).to_tuple()

                   __snake_case      :					List[str]						=  fx_model(**__a   ).to_tuple()
                   self.assertEqual(len(__a   )	,			len(__a   )	,			'Output lengths differ between Flax and PyTorch'   )
                   for fx_output, pt_output in zip(__a	,			__a   ):
                         self.assert_almost_equals(fx_output[:, -1]	,			pt_output[:, -1].numpy()	,			4e-2   )

                   with tempfile.TemporaryDirectory() as tmpdirname:
                         pt_model.save_pretrained(__a   )
                         __snake_case      :					int						=  model_class.from_pretrained(__a	,			from_pt=__a   )

                   __snake_case      :					Optional[Any]						=  fx_model_loaded(**__a   ).to_tuple()
                   self.assertEqual(
                       len(__a   )	,			len(__a   )	,			'Output lengths differ between Flax and PyTorch'   )
                   for fx_output_loaded, pt_output in zip(__a	,			__a   ):
                         self.assert_almost_equals(fx_output_loaded[:, -1]	,			pt_output[:, -1].numpy()	,			4e-2   )
 @is_pt_flax_cross_test
 def A_					(					self		:				Optional[Any]   )	->					Optional[int]:







       '''simple docstring'''
       __snake_case				,			__snake_case      :					Tuple						=  self.model_tester.prepare_config_and_inputs_for_common()
       for model_class in self.all_model_classes:
             with self.subTest(model_class.__name__   ):
                   # prepare inputs
                   __snake_case      :					Optional[Any]						=  self._prepare_for_class(__a	,			__a   )
                   __snake_case      :					Dict						=  {k: torch.tensor(v.tolist()   ) for k, v in prepared_inputs_dict.items()}

                   # load corresponding PyTorch class
                   __snake_case      :					Any						=  model_class.__name__[4:]  # Skip the "Flax" at the beginning
                   __snake_case      :					Optional[int]						=  getattr(__a	,			__a   )

                   __snake_case      :					List[str]						=  pt_model_class(__a   ).eval()
                   __snake_case      :					Tuple						=  model_class(__a	,			dtype=jnp.floataa   )

                   __snake_case      :					int						=  load_flax_weights_in_pytorch_model(__a	,			fx_model.params   )
                   __snake_case				,			__snake_case      :					Optional[Any]						=  pt_inputs['input_ids'].shape
                   __snake_case      :					Dict						=  np.random.randint(0	,			seq_length - 1	,			size=(batch_size,)   )
                   for batch_idx, start_index in enumerate(__a   ):
                         __snake_case      :					Dict						=  0
                         __snake_case      :					str						=  1
                         __snake_case      :					List[Any]						=  0
                         __snake_case      :					str						=  1

                   # make sure weights are tied in PyTorch
                   pt_model.tie_weights()

                   with torch.no_grad():
                         __snake_case      :					List[str]						=  pt_model(**__a   ).to_tuple()

                   __snake_case      :					str						=  fx_model(**__a   ).to_tuple()
                   self.assertEqual(len(__a   )	,			len(__a   )	,			'Output lengths differ between Flax and PyTorch'   )
                   for fx_output, pt_output in zip(__a	,			__a   ):
                         self.assert_almost_equals(fx_output[:, -1]	,			pt_output[:, -1].numpy()	,			4e-2   )

                   with tempfile.TemporaryDirectory() as tmpdirname:
                         fx_model.save_pretrained(__a   )
                         __snake_case      :					Dict						=  pt_model_class.from_pretrained(__a	,			from_flax=__a   )

                   with torch.no_grad():
                         __snake_case      :					int						=  pt_model_loaded(**__a   ).to_tuple()

                   self.assertEqual(
                       len(__a   )	,			len(__a   )	,			'Output lengths differ between Flax and PyTorch'   )
                   for fx_output, pt_output in zip(__a	,			__a   ):
                         self.assert_almost_equals(fx_output[:, -1]	,			pt_output[:, -1].numpy()	,			4e-2   )





 @slow
 def A_					(					self		:				Tuple   )	->					str:







       '''simple docstring'''
       for model_class_name in self.all_model_classes:
             __snake_case      :					List[str]						=  model_class_name.from_pretrained('EleutherAI/gpt-neo-125M'   )
             __snake_case      :					Any						=  model(np.ones((1, 1)   )   )
             self.assertIsNotNone(__a   )









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


if is_torch_available():
 import torch

if is_vision_available():
 from PIL import Image

 from transformers import TvltImageProcessor




def     __SCREAMING_SNAKE_CASE      (     lowercase_    ,   lowercase_=10    ,   lowercase_=10    ,   lowercase_=False    ,   lowercase_=False					)				->		Dict:

    """simple docstring"""


    __UpperCamelCase     						=  []
    for i in range(image_processor_tester.num_frames					):
        video.append(np.random.randint(2_55    ,   size=(image_processor_tester.num_channels, width, height)    ,   dtype=np.uinta					)					)

    if not numpify and not torchify:
        # PIL expects the channel dimension as last dimension
        __UpperCamelCase     						=  [Image.fromarray(np.moveaxis(lowercase_    ,   0    ,   -1					)					) for frame in video]

    if torchify:
        __UpperCamelCase     						=  [torch.from_numpy(lowercase_					) for frame in video]

    return video




def     __SCREAMING_SNAKE_CASE      (     lowercase_    ,   lowercase_=False    ,   lowercase_=False    ,   lowercase_=False					)				->		Tuple:

    """simple docstring"""


    assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"

    __UpperCamelCase     						=  []
    for i in range(image_processor_tester.batch_size					):
        if equal_resolution:
            __UpperCamelCase     						=  __UpperCamelCase     						=  image_processor_tester.max_resolution
        else:
            __UpperCamelCase						,					__UpperCamelCase     						=  np.random.choice(
                np.arange(image_processor_tester.min_resolution    ,   image_processor_tester.max_resolution					)    ,   2					)
            __UpperCamelCase     						=  prepare_video(
                image_processor_tester=lowercase_    ,   width=lowercase_    ,   height=lowercase_    ,   numpify=lowercase_    ,   torchify=lowercase_    ,   )
        video_inputs.append(lowercase_					)

    return video_inputs

class        _lowerCamelCase  (	unittest.TestCase      ):

      """simple docstring"""

      def __init__(   self    :       List[str]       ,				snake_case    :       int       ,				snake_case    :       int=7       ,				snake_case    :       int=3       ,				snake_case    :       Any=4       ,				snake_case    :       Tuple=18       ,				snake_case    :       Optional[int]=30       ,				snake_case    :       List[Any]=400       ,				snake_case    :       str=True       ,				snake_case    :       str=None       ,				snake_case    :       Optional[Any]=True       ,				snake_case    :       str=[0.5, 0.5, 0.5]       ,				snake_case    :       Optional[int]=[0.5, 0.5, 0.5]       ,				snake_case    :       Any=True       ,				snake_case    :       str=None       ,				):
          __UpperCamelCase     						=  size if size is not None else {'''shortest_edge''': 18}
          __UpperCamelCase     						=  crop_size if crop_size is not None else {'''height''': 18, '''width''': 18}

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







      def 					snake_case		(   self    :       Any ):
          return {
              "image_mean": self.image_mean,
              "image_std": self.image_std,
              "do_normalize": self.do_normalize,
              "do_resize": self.do_resize,
              "size": self.size,
              "do_center_crop": self.do_center_crop,
              "crop_size": self.crop_size,
          }







@require_torch
@require_vision
class        _lowerCamelCase  (	_SCREAMING_SNAKE_CASE							,	unittest.TestCase      ):

      """simple docstring"""

      lowerCAmelCase__	:       str			=    TvltImageProcessor if is_vision_available() else None







      def 					snake_case		(   self    :       Dict ):
          __UpperCamelCase     						=  TvltImageProcessorTester(self )







      @property
      def 					snake_case		(   self    :       Dict ):
          return self.image_processor_tester.prepare_image_processor_dict()







      def 					snake_case		(   self    :       int ):
          __UpperCamelCase     						=  self.image_processing_class(**self.image_processor_dict )
          self.assertTrue(hasattr(snake_case       ,				'''image_mean''' ) )
          self.assertTrue(hasattr(snake_case       ,				'''image_std''' ) )
          self.assertTrue(hasattr(snake_case       ,				'''do_normalize''' ) )
          self.assertTrue(hasattr(snake_case       ,				'''do_resize''' ) )
          self.assertTrue(hasattr(snake_case       ,				'''do_center_crop''' ) )
          self.assertTrue(hasattr(snake_case       ,				'''size''' ) )







      def 					snake_case		(   self    :       Union[str, Any] ):
          # Initialize image_processor
          __UpperCamelCase     						=  self.image_processing_class(**self.image_processor_dict )
          # create random PIL videos
          __UpperCamelCase     						=  prepare_video_inputs(self.image_processor_tester       ,				equal_resolution=snake_case )
          for video in video_inputs:
              self.assertIsInstance(snake_case       ,				snake_case )
              self.assertIsInstance(video[0]       ,				Image.Image )

          # Test not batched input
          __UpperCamelCase     						=  image_processor(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
          __UpperCamelCase     						=  image_processor(snake_case       ,				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 					snake_case		(   self    :       List[Any] ):
          # Initialize image_processor
          __UpperCamelCase     						=  self.image_processing_class(**self.image_processor_dict )
          # create random numpy tensors
          __UpperCamelCase     						=  prepare_video_inputs(self.image_processor_tester       ,				equal_resolution=snake_case       ,				numpify=snake_case )
          for video in video_inputs:
              self.assertIsInstance(snake_case       ,				snake_case )
              self.assertIsInstance(video[0]       ,				np.ndarray )

          # Test not batched input
          __UpperCamelCase     						=  image_processor(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
          __UpperCamelCase     						=  image_processor(snake_case       ,				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 					snake_case		(   self    :       Union[str, Any] ):
          # Initialize image_processor
          __UpperCamelCase     						=  self.image_processing_class(**self.image_processor_dict )
          # create random PyTorch tensors
          __UpperCamelCase     						=  prepare_video_inputs(self.image_processor_tester       ,				equal_resolution=snake_case       ,				torchify=snake_case )
          for video in video_inputs:
              self.assertIsInstance(snake_case       ,				snake_case )
              self.assertIsInstance(video[0]       ,				torch.Tensor )

          # Test not batched input
          __UpperCamelCase     						=  image_processor(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
          __UpperCamelCase     						=  image_processor(snake_case       ,				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'''],
              )       ,				)






