

"""simple docstring"""






from __future__ import annotations

import copy
import tempfile
import unittest

from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available
from transformers.testing_utils import (
    DUMMY_UNKNOWN_IDENTIFIER,
    SMALL_MODEL_IDENTIFIER,
    RequestCounter,
    require_tensorflow_probability,
    require_tf,
    slow,
)

from ..bert.test_modeling_bert import BertModelTester


if is_tf_available():
						from transformers import (
						    TFAutoModel,
						    TFAutoModelForCausalLM,
						    TFAutoModelForMaskedLM,
						    TFAutoModelForPreTraining,
						    TFAutoModelForQuestionAnswering,
						    TFAutoModelForSeqaSeqLM,
						    TFAutoModelForSequenceClassification,
						    TFAutoModelForTableQuestionAnswering,
						    TFAutoModelForTokenClassification,
						    TFAutoModelWithLMHead,
						    TFBertForMaskedLM,
						    TFBertForPreTraining,
						    TFBertForQuestionAnswering,
						    TFBertForSequenceClassification,
						    TFBertModel,
						    TFFunnelBaseModel,
						    TFFunnelModel,
						    TFGPTaLMHeadModel,
						    TFRobertaForMaskedLM,
						    TFTaForConditionalGeneration,
						    TFTapasForQuestionAnswering,
						)
						from transformers.models.auto.modeling_tf_auto import (
						    TF_MODEL_FOR_CAUSAL_LM_MAPPING,
						    TF_MODEL_FOR_MASKED_LM_MAPPING,
						    TF_MODEL_FOR_PRETRAINING_MAPPING,
						    TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
						    TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
						    TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
						    TF_MODEL_MAPPING,
						)
						from transformers.models.bert.modeling_tf_bert import TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST
						from transformers.models.gpta.modeling_tf_gpta import TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST
						from transformers.models.ta.modeling_tf_ta import TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST
						from transformers.models.tapas.modeling_tf_tapas import TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST






class 			_UpperCAmelCase	(						lowerCAmelCase_):
			__a       :				Optional[int]     =							'new-model'


if is_tf_available():






						class 			_UpperCAmelCase	(						lowerCAmelCase_):
									__a       :				Any     =							NewModelConfig






@require_tf
class 			_UpperCAmelCase	(						unittest.TestCase):
			@slow
			def 							__snake_case       (						self   )			->			Any:






				'''simple docstring'''







				_UpperCAmelCase			:							Dict	  =    """bert-base-cased"""
				_UpperCAmelCase			:							str	  =    AutoConfig.from_pretrained(__lowerCAmelCase   )
				self.assertIsNotNone(__lowerCAmelCase   )
				self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

				_UpperCAmelCase			:							int	  =    TFAutoModel.from_pretrained(__lowerCAmelCase   )
				self.assertIsNotNone(__lowerCAmelCase   )
				self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			@slow
			def 							__snake_case       (						self   )			->			List[str]:






				'''simple docstring'''







				_UpperCAmelCase			:							List[str]	  =    """bert-base-cased"""
				_UpperCAmelCase			:							Optional[Any]	  =    AutoConfig.from_pretrained(__lowerCAmelCase   )
				self.assertIsNotNone(__lowerCAmelCase   )
				self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

				_UpperCAmelCase			:							List[str]	  =    TFAutoModelForPreTraining.from_pretrained(__lowerCAmelCase   )
				self.assertIsNotNone(__lowerCAmelCase   )
				self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			@slow
			def 							__snake_case       (						self   )			->			Optional[int]:






				'''simple docstring'''







				for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
					_UpperCAmelCase			:							Tuple	  =    AutoConfig.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

					_UpperCAmelCase			:							List[str]	  =    TFAutoModelForCausalLM.from_pretrained(__lowerCAmelCase   )
					_UpperCAmelCase  ,      _UpperCAmelCase			:							Optional[Any]	  =    TFAutoModelForCausalLM.from_pretrained(__lowerCAmelCase					,						output_loading_info=__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			@slow
			def 							__snake_case       (						self   )			->			Union[str, Any]:






				'''simple docstring'''







				for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
					_UpperCAmelCase			:							List[Any]	  =    AutoConfig.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

					_UpperCAmelCase			:							Tuple	  =    TFAutoModelWithLMHead.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			@slow
			def 							__snake_case       (						self   )			->			Dict:






				'''simple docstring'''







				for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
					_UpperCAmelCase			:							Dict	  =    AutoConfig.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

					_UpperCAmelCase			:							List[Any]	  =    TFAutoModelForMaskedLM.from_pretrained(__lowerCAmelCase   )
					_UpperCAmelCase  ,      _UpperCAmelCase			:							Optional[int]	  =    TFAutoModelForMaskedLM.from_pretrained(__lowerCAmelCase					,						output_loading_info=__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			@slow
			def 							__snake_case       (						self   )			->			str:






				'''simple docstring'''







				for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
					_UpperCAmelCase			:							Union[str, Any]	  =    AutoConfig.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

					_UpperCAmelCase			:							int	  =    TFAutoModelForSeqaSeqLM.from_pretrained(__lowerCAmelCase   )
					_UpperCAmelCase  ,      _UpperCAmelCase			:							Optional[int]	  =    TFAutoModelForSeqaSeqLM.from_pretrained(__lowerCAmelCase					,						output_loading_info=__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			@slow
			def 							__snake_case       (						self   )			->			List[str]:






				'''simple docstring'''







				for model_name in ["bert-base-uncased"]:
					_UpperCAmelCase			:							Dict	  =    AutoConfig.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

					_UpperCAmelCase			:							Tuple	  =    TFAutoModelForSequenceClassification.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			@slow
			def 							__snake_case       (						self   )			->			Optional[int]:






				'''simple docstring'''







				for model_name in ["bert-base-uncased"]:
					_UpperCAmelCase			:							Dict	  =    AutoConfig.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

					_UpperCAmelCase			:							Union[str, Any]	  =    TFAutoModelForQuestionAnswering.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			@slow
			@require_tensorflow_probability
			def 							__snake_case       (						self   )			->			Optional[int]:






				'''simple docstring'''







				for model_name in TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST[5:6]:
					_UpperCAmelCase			:							List[Any]	  =    AutoConfig.from_pretrained(__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

					_UpperCAmelCase			:							str	  =    TFAutoModelForTableQuestionAnswering.from_pretrained(__lowerCAmelCase   )
					_UpperCAmelCase  ,      _UpperCAmelCase			:							Union[str, Any]	  =    TFAutoModelForTableQuestionAnswering.from_pretrained(
					    __lowerCAmelCase					,						output_loading_info=__lowerCAmelCase   )
					self.assertIsNotNone(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			def 							__snake_case       (						self   )			->			List[str]:






				'''simple docstring'''







				_UpperCAmelCase			:							int	  =    TFAutoModelWithLMHead.from_pretrained(__lowerCAmelCase   )
				self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
				self.assertEqual(model.num_parameters()					,						1_44_10   )
				self.assertEqual(model.num_parameters(only_trainable=__lowerCAmelCase   )					,						1_44_10   )
			def 							__snake_case       (						self   )			->			Any:






				'''simple docstring'''







				_UpperCAmelCase			:							Union[str, Any]	  =    TFAutoModelWithLMHead.from_pretrained(__lowerCAmelCase   )
				self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
				self.assertEqual(model.num_parameters()					,						1_44_10   )
				self.assertEqual(model.num_parameters(only_trainable=__lowerCAmelCase   )					,						1_44_10   )
			def 							__snake_case       (						self   )			->			Optional[int]:






				'''simple docstring'''







				_UpperCAmelCase			:							Dict	  =    TFAutoModel.from_pretrained("""sgugger/funnel-random-tiny"""   )
				self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

				_UpperCAmelCase			:							Dict	  =    copy.deepcopy(model.config   )
				_UpperCAmelCase			:							Dict	  =    ["""FunnelBaseModel"""]
				_UpperCAmelCase			:							Any	  =    TFAutoModel.from_config(__lowerCAmelCase   )
				self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

				with tempfile.TemporaryDirectory() as tmp_dir:
					model.save_pretrained(__lowerCAmelCase   )
					_UpperCAmelCase			:							Union[str, Any]	  =    TFAutoModel.from_pretrained(__lowerCAmelCase   )
					self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )
			def 							__snake_case       (						self   )			->			Tuple:






				'''simple docstring'''







				try:
					AutoConfig.register("""new-model"""					,						__lowerCAmelCase   )

					_UpperCAmelCase			:							List[Any]	  =    [
					    TFAutoModel,
					    TFAutoModelForCausalLM,
					    TFAutoModelForMaskedLM,
					    TFAutoModelForPreTraining,
					    TFAutoModelForQuestionAnswering,
					    TFAutoModelForSequenceClassification,
					    TFAutoModelForTokenClassification,
					]

					for auto_class in auto_classes:
						with self.subTest(auto_class.__name__   ):
							# Wrong config class will raise an error
							with self.assertRaises(__lowerCAmelCase   ):
								auto_class.register(__lowerCAmelCase					,						__lowerCAmelCase   )
							auto_class.register(__lowerCAmelCase					,						__lowerCAmelCase   )
							# Trying to register something existing in the Transformers library will raise an error
							with self.assertRaises(__lowerCAmelCase   ):
								auto_class.register(__lowerCAmelCase					,						__lowerCAmelCase   )

							# Now that the config is registered, it can be used as any other config with the auto-API
							_UpperCAmelCase			:							Union[str, Any]	  =    BertModelTester(self   ).get_config()
							_UpperCAmelCase			:							int	  =    NewModelConfig(**tiny_config.to_dict()   )
							_UpperCAmelCase			:							Dict	  =    auto_class.from_config(__lowerCAmelCase   )
							self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

							with tempfile.TemporaryDirectory() as tmp_dir:
								model.save_pretrained(__lowerCAmelCase   )
								_UpperCAmelCase			:							int	  =    auto_class.from_pretrained(__lowerCAmelCase   )
								self.assertIsInstance(__lowerCAmelCase					,						__lowerCAmelCase   )

				finally:
					if "new-model" in CONFIG_MAPPING._extra_content:
						del CONFIG_MAPPING._extra_content["new-model"]
					for mapping in (
					    TF_MODEL_MAPPING,
					    TF_MODEL_FOR_PRETRAINING_MAPPING,
					    TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
					    TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
					    TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
					    TF_MODEL_FOR_CAUSAL_LM_MAPPING,
					    TF_MODEL_FOR_MASKED_LM_MAPPING,
					):
						if NewModelConfig in mapping._extra_content:
							del mapping._extra_content[NewModelConfig]
			def 							__snake_case       (						self   )			->			Any:






				'''simple docstring'''







				with self.assertRaisesRegex(
				    __lowerCAmelCase					,						"""bert-base is not a local folder and is not a valid model identifier"""   ):
					_UpperCAmelCase			:							int	  =    TFAutoModel.from_pretrained("""bert-base"""   )
			def 							__snake_case       (						self   )			->			Union[str, Any]:






				'''simple docstring'''







				with self.assertRaisesRegex(
				    __lowerCAmelCase					,						r"""aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)"""   ):
					_UpperCAmelCase			:							Tuple	  =    TFAutoModel.from_pretrained(__lowerCAmelCase					,						revision="""aaaaaa"""   )
			def 							__snake_case       (						self   )			->			List[Any]:






				'''simple docstring'''







				with self.assertRaisesRegex(
				    __lowerCAmelCase					,						"""hf-internal-testing/config-no-model does not appear to have a file named pytorch_model.bin"""					,						):
					_UpperCAmelCase			:							Any	  =    TFAutoModel.from_pretrained("""hf-internal-testing/config-no-model"""   )
			def 							__snake_case       (						self   )			->			Union[str, Any]:






				'''simple docstring'''







				with self.assertRaisesRegex(__lowerCAmelCase					,						"""Use `from_pt=True` to load this model"""   ):
					_UpperCAmelCase			:							int	  =    TFAutoModel.from_pretrained("""hf-internal-testing/tiny-bert-pt-only"""   )
			def 							__snake_case       (						self   )			->			Dict:






				'''simple docstring'''







				_UpperCAmelCase			:							int	  =    TFAutoModel.from_pretrained("""hf-internal-testing/tiny-random-bert"""   )
				with RequestCounter() as counter:
					_UpperCAmelCase			:							int	  =    TFAutoModel.from_pretrained("""hf-internal-testing/tiny-random-bert"""   )
					self.assertEqual(counter.get_request_count					,						0   )
					self.assertEqual(counter.head_request_count					,						1   )
					self.assertEqual(counter.other_request_count					,						0   )

				# With a sharded checkpoint
				_UpperCAmelCase			:							int	  =    TFAutoModel.from_pretrained("""ArthurZ/tiny-random-bert-sharded"""   )
				with RequestCounter() as counter:
					_UpperCAmelCase			:							Union[str, Any]	  =    TFAutoModel.from_pretrained("""ArthurZ/tiny-random-bert-sharded"""   )
					self.assertEqual(counter.get_request_count					,						0   )
					self.assertEqual(counter.head_request_count					,						1   )
					self.assertEqual(counter.other_request_count					,						0   )






"""simple docstring"""


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_image_inputs


if is_torch_available():
    import torch

if is_vision_available():
    from PIL import Image

    from transformers import MobileViTImageProcessor


class 				a (						unittest.TestCase      ):


    def __init__(    self		:     Dict      , __lowerCAmelCase		:     Tuple      , __lowerCAmelCase		:     Optional[Any]=7      , __lowerCAmelCase		:     Optional[Any]=3      , __lowerCAmelCase		:     Optional[Any]=18      , __lowerCAmelCase		:     str=30      , __lowerCAmelCase		:     List[str]=400      , __lowerCAmelCase		:     Union[str, Any]=True      , __lowerCAmelCase		:     str=None      , __lowerCAmelCase		:     Optional[int]=True      , __lowerCAmelCase		:     int=None      , __lowerCAmelCase		:     List[str]=True      , ):
      _UpperCAmelCase         =					size if size is not None else {"""shortest_edge""": 20}
      _UpperCAmelCase         =					crop_size if crop_size is not None else {"""height""": 18, """width""": 18}
      _UpperCAmelCase         =					parent
      _UpperCAmelCase         =					batch_size
      _UpperCAmelCase         =					num_channels
      _UpperCAmelCase         =					image_size
      _UpperCAmelCase         =					min_resolution
      _UpperCAmelCase         =					max_resolution
      _UpperCAmelCase         =					do_resize
      _UpperCAmelCase         =					size
      _UpperCAmelCase         =					do_center_crop
      _UpperCAmelCase         =					crop_size
      _UpperCAmelCase         =					do_flip_channel_order


    def    lowerCAmelCase_     (    self		:     List[str]    ):
      return {
          "do_resize": self.do_resize,
          "size": self.size,
          "do_center_crop": self.do_center_crop,
          "crop_size": self.crop_size,
          "do_flip_channel_order": self.do_flip_channel_order,
      }



@require_torch
@require_vision
class 				a (						lowerCAmelCase_		,							unittest.TestCase      ):
    _snake_case   :     Optional[int]   							=							MobileViTImageProcessor if is_vision_available() else None


    def    lowerCAmelCase_     (    self		:     Optional[Any]    ):
      _UpperCAmelCase         =					MobileViTImageProcessingTester(self    )


    @property
    def    lowerCAmelCase_     (    self		:     Tuple    ):
      return self.image_processor_tester.prepare_image_processor_dict()


    def    lowerCAmelCase_     (    self		:     Dict    ):
      _UpperCAmelCase         =					self.image_processing_class(**self.image_processor_dict    )
      self.assertTrue(hasattr(__lowerCAmelCase      , """do_resize"""    )    )
      self.assertTrue(hasattr(__lowerCAmelCase      , """size"""    )    )
      self.assertTrue(hasattr(__lowerCAmelCase      , """do_center_crop"""    )    )
      self.assertTrue(hasattr(__lowerCAmelCase      , """center_crop"""    )    )
      self.assertTrue(hasattr(__lowerCAmelCase      , """do_flip_channel_order"""    )    )


    def    lowerCAmelCase_     (    self		:     Union[str, Any]    ):
      _UpperCAmelCase         =					self.image_processing_class.from_dict(self.image_processor_dict    )
      self.assertEqual(image_processor.size      , {"""shortest_edge""": 20}    )
      self.assertEqual(image_processor.crop_size      , {"""height""": 18, """width""": 18}    )

      _UpperCAmelCase         =					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    lowerCAmelCase_     (    self		:     List[str]    ):
      pass


    def    lowerCAmelCase_     (    self		:     Dict    ):
      # Initialize image_processing
      _UpperCAmelCase         =					self.image_processing_class(**self.image_processor_dict    )
      # create random PIL images
      _UpperCAmelCase         =					prepare_image_inputs(self.image_processor_tester      , equal_resolution=__lowerCAmelCase    )
      for image in image_inputs:
        self.assertIsInstance(__lowerCAmelCase      , Image.Image    )

      # Test not batched input
      _UpperCAmelCase         =					image_processing(image_inputs[0]      , return_tensors="""pt"""    ).pixel_values
      self.assertEqual(
          encoded_images.shape      , (
              1,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size["""height"""],
              self.image_processor_tester.crop_size["""width"""],
          )      , )

      # Test batched
      _UpperCAmelCase         =					image_processing(__lowerCAmelCase      , return_tensors="""pt"""    ).pixel_values
      self.assertEqual(
          encoded_images.shape      , (
              self.image_processor_tester.batch_size,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size["""height"""],
              self.image_processor_tester.crop_size["""width"""],
          )      , )


    def    lowerCAmelCase_     (    self		:     str    ):
      # Initialize image_processing
      _UpperCAmelCase         =					self.image_processing_class(**self.image_processor_dict    )
      # create random numpy tensors
      _UpperCAmelCase         =					prepare_image_inputs(self.image_processor_tester      , equal_resolution=__lowerCAmelCase      , numpify=__lowerCAmelCase    )
      for image in image_inputs:
        self.assertIsInstance(__lowerCAmelCase      , np.ndarray    )

      # Test not batched input
      _UpperCAmelCase         =					image_processing(image_inputs[0]      , return_tensors="""pt"""    ).pixel_values
      self.assertEqual(
          encoded_images.shape      , (
              1,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size["""height"""],
              self.image_processor_tester.crop_size["""width"""],
          )      , )

      # Test batched
      _UpperCAmelCase         =					image_processing(__lowerCAmelCase      , return_tensors="""pt"""    ).pixel_values
      self.assertEqual(
          encoded_images.shape      , (
              self.image_processor_tester.batch_size,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size["""height"""],
              self.image_processor_tester.crop_size["""width"""],
          )      , )


    def    lowerCAmelCase_     (    self		:     Optional[int]    ):
      # Initialize image_processing
      _UpperCAmelCase         =					self.image_processing_class(**self.image_processor_dict    )
      # create random PyTorch tensors
      _UpperCAmelCase         =					prepare_image_inputs(self.image_processor_tester      , equal_resolution=__lowerCAmelCase      , torchify=__lowerCAmelCase    )
      for image in image_inputs:
        self.assertIsInstance(__lowerCAmelCase      , torch.Tensor    )

      # Test not batched input
      _UpperCAmelCase         =					image_processing(image_inputs[0]      , return_tensors="""pt"""    ).pixel_values
      self.assertEqual(
          encoded_images.shape      , (
              1,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size["""height"""],
              self.image_processor_tester.crop_size["""width"""],
          )      , )

      # Test batched
      _UpperCAmelCase         =					image_processing(__lowerCAmelCase      , return_tensors="""pt"""    ).pixel_values
      self.assertEqual(
          encoded_images.shape      , (
              self.image_processor_tester.batch_size,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size["""height"""],
              self.image_processor_tester.crop_size["""width"""],
          )      , )
