import inspect
import unittest

from transformers import is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
      import torch

      from transformers import MODEL_MAPPING, GLPNConfig, GLPNForDepthEstimation, GLPNModel
      from transformers.models.glpn.modeling_glpn import GLPN_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
      from PIL import Image

      from transformers import GLPNImageProcessor





class   A							(       UpperCAmelCase_  ):


   def     lowercase_   (self  :		Tuple	)		->       int:
         """simple docstring"""



         UpperCAmelCase__			=						self.config_class(**self.inputs_dict	)
         self.parent.assertTrue(hasattr(__UpperCAmelCase ,						"hidden_sizes"	)	)
         self.parent.assertTrue(hasattr(__UpperCAmelCase ,						"num_attention_heads"	)	)
         self.parent.assertTrue(hasattr(__UpperCAmelCase ,						"num_encoder_blocks"	)	)





class   A							:


   def __init__(self  :		Tuple ,						__UpperCAmelCase  :		Any ,						__UpperCAmelCase  :		Union[str, Any]=1_3 ,						__UpperCAmelCase  :		Any=6_4 ,						__UpperCAmelCase  :		Optional[Any]=3 ,						__UpperCAmelCase  :		List[str]=4 ,						__UpperCAmelCase  :		Any=[2, 2, 2, 2] ,						__UpperCAmelCase  :		Union[str, Any]=[8, 4, 2, 1] ,						__UpperCAmelCase  :		List[str]=[1_6, 3_2, 6_4, 1_2_8] ,						__UpperCAmelCase  :		str=[1, 4, 8, 1_6] ,						__UpperCAmelCase  :		Optional[int]=[1, 2, 4, 8] ,						__UpperCAmelCase  :		Tuple=True ,						__UpperCAmelCase  :		Optional[int]=True ,						__UpperCAmelCase  :		str="gelu" ,						__UpperCAmelCase  :		List[Any]=0.1 ,						__UpperCAmelCase  :		List[Any]=0.1 ,						__UpperCAmelCase  :		Dict=0.02 ,						__UpperCAmelCase  :		Dict=1_6 ,						__UpperCAmelCase  :		Tuple=3 ,						__UpperCAmelCase  :		Dict=None ,						)		->       Optional[Any]:
         """simple docstring"""



         UpperCAmelCase__			=						parent
         UpperCAmelCase__			=						batch_size
         UpperCAmelCase__			=						image_size
         UpperCAmelCase__			=						num_channels
         UpperCAmelCase__			=						num_encoder_blocks
         UpperCAmelCase__			=						sr_ratios
         UpperCAmelCase__			=						depths
         UpperCAmelCase__			=						hidden_sizes
         UpperCAmelCase__			=						downsampling_rates
         UpperCAmelCase__			=						num_attention_heads
         UpperCAmelCase__			=						is_training
         UpperCAmelCase__			=						use_labels
         UpperCAmelCase__			=						hidden_act
         UpperCAmelCase__			=						hidden_dropout_prob
         UpperCAmelCase__			=						attention_probs_dropout_prob
         UpperCAmelCase__			=						initializer_range
         UpperCAmelCase__			=						decoder_hidden_size
         UpperCAmelCase__			=						num_labels
         UpperCAmelCase__			=						scope


   def     lowercase_   (self  :		Tuple	)		->       Optional[int]:
         """simple docstring"""



         UpperCAmelCase__			=						floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]	)

         UpperCAmelCase__			=						None
         if self.use_labels:
               UpperCAmelCase__			=						ids_tensor([self.batch_size, self.image_size, self.image_size] ,						self.num_labels	)

         UpperCAmelCase__			=						self.get_config()
         return config, pixel_values, labels


   def     lowercase_   (self  :		int	)		->       List[Any]:
         """simple docstring"""



         return GLPNConfig(
             image_size=self.image_size ,						num_channels=self.num_channels ,						num_encoder_blocks=self.num_encoder_blocks ,						depths=self.depths ,						hidden_sizes=self.hidden_sizes ,						num_attention_heads=self.num_attention_heads ,						hidden_act=self.hidden_act ,						hidden_dropout_prob=self.hidden_dropout_prob ,						attention_probs_dropout_prob=self.attention_probs_dropout_prob ,						initializer_range=self.initializer_range ,						decoder_hidden_size=self.decoder_hidden_size ,						)


   def     lowercase_   (self  :		Optional[Any] ,						__UpperCAmelCase  :		Dict ,						__UpperCAmelCase  :		Any ,						__UpperCAmelCase  :		int	)		->       Tuple:
         """simple docstring"""



         UpperCAmelCase__			=						GLPNModel(config=__UpperCAmelCase	)
         model.to(__UpperCAmelCase	)
         model.eval()
         UpperCAmelCase__			=						model(__UpperCAmelCase	)
         UpperCAmelCase__			=						UpperCAmelCase__			=						self.image_size // (self.downsampling_rates[-1] * 2)
         self.parent.assertEqual(
             result.last_hidden_state.shape ,						(self.batch_size, self.hidden_sizes[-1], expected_height, expected_width)	)


   def     lowercase_   (self  :		Any ,						__UpperCAmelCase  :		List[Any] ,						__UpperCAmelCase  :		Optional[int] ,						__UpperCAmelCase  :		Union[str, Any]	)		->       int:
         """simple docstring"""



         UpperCAmelCase__			=						self.num_labels
         UpperCAmelCase__			=						GLPNForDepthEstimation(__UpperCAmelCase	)
         model.to(__UpperCAmelCase	)
         model.eval()
         UpperCAmelCase__			=						model(__UpperCAmelCase	)
         self.parent.assertEqual(result.predicted_depth.shape ,						(self.batch_size, self.image_size, self.image_size)	)
         UpperCAmelCase__			=						model(__UpperCAmelCase ,						labels=__UpperCAmelCase	)
         self.parent.assertEqual(result.predicted_depth.shape ,						(self.batch_size, self.image_size, self.image_size)	)





   def     lowercase_   (self  :		str	)		->       Dict:
         """simple docstring"""



         UpperCAmelCase__			=						self.prepare_config_and_inputs()
         UpperCAmelCase__	,   UpperCAmelCase__	,   UpperCAmelCase__			=						config_and_inputs
         UpperCAmelCase__			=						{"pixel_values": pixel_values}
         return config, inputs_dict





@require_torch
class   A							(       UpperCAmelCase_	,       UpperCAmelCase_	,       unittest.TestCase  ):
   __UpperCAmelCase				:				Tuple          =    (GLPNModel, GLPNForDepthEstimation) if is_torch_available() else ()
   __UpperCAmelCase				:				int          =    (
       {'depth-estimation': GLPNForDepthEstimation, 'feature-extraction': GLPNModel} if is_torch_available() else {}
   )

   __UpperCAmelCase				:				List[str]          =    False
   __UpperCAmelCase				:				int          =    False
   __UpperCAmelCase				:				List[Any]          =    False


   def     lowercase_   (self  :		Union[str, Any]	)		->       Optional[int]:
         """simple docstring"""



         UpperCAmelCase__			=						GLPNModelTester(self	)
         UpperCAmelCase__			=						GLPNConfigTester(self ,						config_class=__UpperCAmelCase	)


   def     lowercase_   (self  :		Dict	)		->       Tuple:
         """simple docstring"""



         self.config_tester.run_common_tests()


   def     lowercase_   (self  :		int	)		->       Dict:
         """simple docstring"""



         UpperCAmelCase__			=						self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_model(*__UpperCAmelCase	)


   def     lowercase_   (self  :		Optional[Any]	)		->       List[Any]:
         """simple docstring"""



         UpperCAmelCase__			=						self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_depth_estimation(*__UpperCAmelCase	)


   @unittest.skip("GLPN does not use inputs_embeds"	)
   def     lowercase_   (self  :		int	)		->       str:
         """simple docstring"""



         pass


   @unittest.skip("GLPN does not have get_input_embeddings method and get_output_embeddings methods"	)
   def     lowercase_   (self  :		Optional[Any]	)		->       Dict:
         """simple docstring"""



         pass


   def     lowercase_   (self  :		Union[str, Any]	)		->       List[str]:
         """simple docstring"""



         UpperCAmelCase__	,   UpperCAmelCase__			=						self.model_tester.prepare_config_and_inputs_for_common()

         for model_class in self.all_model_classes:
               UpperCAmelCase__			=						model_class(__UpperCAmelCase	)
               UpperCAmelCase__			=						inspect.signature(model.forward	)
               # signature.parameters is an OrderedDict => so arg_names order is deterministic
               UpperCAmelCase__			=						[*signature.parameters.keys()]

               UpperCAmelCase__			=						["pixel_values"]
               self.assertListEqual(arg_names[:1] ,						__UpperCAmelCase	)


   def     lowercase_   (self  :		Union[str, Any]	)		->       Dict:
         """simple docstring"""



         UpperCAmelCase__	,   UpperCAmelCase__			=						self.model_tester.prepare_config_and_inputs_for_common()
         UpperCAmelCase__			=						True

         for model_class in self.all_model_classes:
               UpperCAmelCase__			=						True
               UpperCAmelCase__			=						False
               UpperCAmelCase__			=						True
               UpperCAmelCase__			=						model_class(__UpperCAmelCase	)
               model.to(__UpperCAmelCase	)
               model.eval()
               with torch.no_grad():
                     UpperCAmelCase__			=						model(**self._prepare_for_class(__UpperCAmelCase ,						__UpperCAmelCase	)	)
               UpperCAmelCase__			=						outputs.attentions

               UpperCAmelCase__			=						sum(self.model_tester.depths	)
               self.assertEqual(len(__UpperCAmelCase	) ,						__UpperCAmelCase	)

               # check that output_attentions also work using config
               del inputs_dict["output_attentions"]
               UpperCAmelCase__			=						True
               UpperCAmelCase__			=						model_class(__UpperCAmelCase	)
               model.to(__UpperCAmelCase	)
               model.eval()
               with torch.no_grad():
                     UpperCAmelCase__			=						model(**self._prepare_for_class(__UpperCAmelCase ,						__UpperCAmelCase	)	)
               UpperCAmelCase__			=						outputs.attentions

               self.assertEqual(len(__UpperCAmelCase	) ,						__UpperCAmelCase	)

               # verify the first attentions (first block, first layer)
               UpperCAmelCase__			=						(self.model_tester.image_size // 4) ** 2
               UpperCAmelCase__			=						(self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
               self.assertListEqual(
                   list(attentions[0].shape[-3:]	) ,						[self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len] ,						)

               # verify the last attentions (last block, last layer)
               UpperCAmelCase__			=						(self.model_tester.image_size // 3_2) ** 2
               UpperCAmelCase__			=						(self.model_tester.image_size // (3_2 * self.model_tester.sr_ratios[-1])) ** 2
               self.assertListEqual(
                   list(attentions[-1].shape[-3:]	) ,						[self.model_tester.num_attention_heads[-1], expected_seq_len, expected_reduced_seq_len] ,						)
               UpperCAmelCase__			=						len(__UpperCAmelCase	)

               # Check attention is always last and order is fine
               UpperCAmelCase__			=						True
               UpperCAmelCase__			=						True
               UpperCAmelCase__			=						model_class(__UpperCAmelCase	)
               model.to(__UpperCAmelCase	)
               model.eval()
               with torch.no_grad():
                     UpperCAmelCase__			=						model(**self._prepare_for_class(__UpperCAmelCase ,						__UpperCAmelCase	)	)

               self.assertEqual(out_len + 1 ,						len(__UpperCAmelCase	)	)

               UpperCAmelCase__			=						outputs.attentions

               self.assertEqual(len(__UpperCAmelCase	) ,						__UpperCAmelCase	)
               # verify the first attentions (first block, first layer)
               UpperCAmelCase__			=						(self.model_tester.image_size // 4) ** 2
               UpperCAmelCase__			=						(self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
               self.assertListEqual(
                   list(self_attentions[0].shape[-3:]	) ,						[self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len] ,						)


   def     lowercase_   (self  :		Optional[Any]	)		->       Optional[Any]:
         """simple docstring"""



         def check_hidden_states_output(__UpperCAmelCase  :		List[Any] ,						__UpperCAmelCase  :		Any ,						__UpperCAmelCase  :		Tuple	):
               UpperCAmelCase__			=						model_class(__UpperCAmelCase	)
               model.to(__UpperCAmelCase	)
               model.eval()

               with torch.no_grad():
                     UpperCAmelCase__			=						model(**self._prepare_for_class(__UpperCAmelCase ,						__UpperCAmelCase	)	)

               UpperCAmelCase__			=						outputs.hidden_states

               UpperCAmelCase__			=						self.model_tester.num_encoder_blocks
               self.assertEqual(len(__UpperCAmelCase	) ,						__UpperCAmelCase	)

               # verify the first hidden states (first block)
               self.assertListEqual(
                   list(hidden_states[0].shape[-3:]	) ,						[
                       self.model_tester.hidden_sizes[0],
                       self.model_tester.image_size // 4,
                       self.model_tester.image_size // 4,
                   ] ,						)

         UpperCAmelCase__	,   UpperCAmelCase__			=						self.model_tester.prepare_config_and_inputs_for_common()

         for model_class in self.all_model_classes:
               UpperCAmelCase__			=						True
               check_hidden_states_output(__UpperCAmelCase ,						__UpperCAmelCase ,						__UpperCAmelCase	)

               # check that output_hidden_states also work using config
               del inputs_dict["output_hidden_states"]
               UpperCAmelCase__			=						True

               check_hidden_states_output(__UpperCAmelCase ,						__UpperCAmelCase ,						__UpperCAmelCase	)


   def     lowercase_   (self  :		Dict	)		->       Optional[int]:
         """simple docstring"""



         if not self.model_tester.is_training:
               return

         UpperCAmelCase__	,   UpperCAmelCase__			=						self.model_tester.prepare_config_and_inputs_for_common()
         UpperCAmelCase__			=						True

         for model_class in self.all_model_classes:
               if model_class in get_values(__UpperCAmelCase	):
                     continue
               # TODO: remove the following 3 lines once we have a MODEL_FOR_DEPTH_ESTIMATION_MAPPING
               # this can then be incorporated into _prepare_for_class in test_modeling_common.py
               if model_class.__name__ == "GLPNForDepthEstimation":
                     UpperCAmelCase__	,   UpperCAmelCase__	,   UpperCAmelCase__	,   UpperCAmelCase__			=						inputs_dict["pixel_values"].shape
                     UpperCAmelCase__			=						torch.zeros(
                         [self.model_tester.batch_size, height, width] ,						device=__UpperCAmelCase	).long()
               UpperCAmelCase__			=						model_class(__UpperCAmelCase	)
               model.to(__UpperCAmelCase	)
               model.train()
               UpperCAmelCase__			=						self._prepare_for_class(__UpperCAmelCase ,						__UpperCAmelCase ,						return_labels=__UpperCAmelCase	)
               UpperCAmelCase__			=						model(**__UpperCAmelCase	).loss
               loss.backward()





   @slow
   def     lowercase_   (self  :		str	)		->       List[Any]:
         """simple docstring"""



         for model_name in GLPN_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               UpperCAmelCase__			=						GLPNModel.from_pretrained(__UpperCAmelCase	)
               self.assertIsNotNone(__UpperCAmelCase	)




def      lowerCAmelCase_				(  )  ->       Dict:







      '''simple docstring'''


      UpperCAmelCase__			=						Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"							)
      return image







@require_torch
@require_vision
@slow
class   A							(       unittest.TestCase  ):


   @slow
   def     lowercase_   (self  :		Dict	)		->       Optional[int]:
         """simple docstring"""



         UpperCAmelCase__			=						GLPNImageProcessor.from_pretrained(GLPN_PRETRAINED_MODEL_ARCHIVE_LIST[0]	)
         UpperCAmelCase__			=						GLPNForDepthEstimation.from_pretrained(GLPN_PRETRAINED_MODEL_ARCHIVE_LIST[0]	).to(__UpperCAmelCase	)

         UpperCAmelCase__			=						prepare_img()
         UpperCAmelCase__			=						image_processor(images=__UpperCAmelCase ,						return_tensors="pt"	).to(__UpperCAmelCase	)

         # forward pass
         with torch.no_grad():
               UpperCAmelCase__			=						model(**__UpperCAmelCase	)

         # verify the predicted depth
         UpperCAmelCase__			=						torch.Size([1, 4_8_0, 6_4_0]	)
         self.assertEqual(outputs.predicted_depth.shape ,						__UpperCAmelCase	)

         UpperCAmelCase__			=						torch.tensor(
             [[3.4291, 2.7865, 2.5151], [3.2841, 2.7021, 2.3502], [3.1147, 2.4625, 2.2481]]	).to(__UpperCAmelCase	)

         self.assertTrue(torch.allclose(outputs.predicted_depth[0, :3, :3] ,						__UpperCAmelCase ,						atol=1E-4	)	)




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 EfficientNetImageProcessor





class   A							(       unittest.TestCase  ):


   def __init__(self  :		Optional[int] ,						__UpperCAmelCase  :		Dict ,						__UpperCAmelCase  :		List[Any]=1_3 ,						__UpperCAmelCase  :		int=3 ,						__UpperCAmelCase  :		int=1_8 ,						__UpperCAmelCase  :		Tuple=3_0 ,						__UpperCAmelCase  :		List[Any]=4_0_0 ,						__UpperCAmelCase  :		Any=True ,						__UpperCAmelCase  :		Dict=None ,						__UpperCAmelCase  :		Optional[Any]=True ,						__UpperCAmelCase  :		Tuple=[0.5, 0.5, 0.5] ,						__UpperCAmelCase  :		Optional[Any]=[0.5, 0.5, 0.5] ,						)		->       Any:
         """simple docstring"""



         UpperCAmelCase__			=						size if size is not None else {"height": 1_8, "width": 1_8}
         UpperCAmelCase__			=						parent
         UpperCAmelCase__			=						batch_size
         UpperCAmelCase__			=						num_channels
         UpperCAmelCase__			=						image_size
         UpperCAmelCase__			=						min_resolution
         UpperCAmelCase__			=						max_resolution
         UpperCAmelCase__			=						do_resize
         UpperCAmelCase__			=						size
         UpperCAmelCase__			=						do_normalize
         UpperCAmelCase__			=						image_mean
         UpperCAmelCase__			=						image_std





   def     lowercase_   (self  :		Optional[int]	)		->       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,
         }





@require_torch
@require_vision
class   A							(       UpperCAmelCase_	,       unittest.TestCase  ):
   __UpperCAmelCase				:				Dict          =    EfficientNetImageProcessor if is_vision_available() else None


   def     lowercase_   (self  :		str	)		->       int:
         """simple docstring"""



         UpperCAmelCase__			=						EfficientNetImageProcessorTester(self	)


   @property
   def     lowercase_   (self  :		Tuple	)		->       Optional[Any]:
         """simple docstring"""



         return self.image_processor_tester.prepare_image_processor_dict()


   def     lowercase_   (self  :		Tuple	)		->       List[Any]:
         """simple docstring"""



         UpperCAmelCase__			=						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 ,						"size"	)	)


   def     lowercase_   (self  :		Tuple	)		->       str:
         """simple docstring"""



         UpperCAmelCase__			=						self.image_processing_class.from_dict(self.image_processor_dict	)
         self.assertEqual(image_processor.size ,						{"height": 1_8, "width": 1_8}	)

         UpperCAmelCase__			=						self.image_processing_class.from_dict(self.image_processor_dict ,						size=4_2	)
         self.assertEqual(image_processor.size ,						{"height": 4_2, "width": 4_2}	)


   def     lowercase_   (self  :		List[Any]	)		->       Optional[int]:
         """simple docstring"""



         UpperCAmelCase__			=						self.image_processing_class(**self.image_processor_dict	)
         # create random PIL images
         UpperCAmelCase__			=						prepare_image_inputs(self.image_processor_tester ,						equal_resolution=__UpperCAmelCase	)
         for image in image_inputs:
               self.assertIsInstance(__UpperCAmelCase ,						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.size["height"],
                 self.image_processor_tester.size["width"],
             ) ,						)

         # Test batched
         UpperCAmelCase__			=						image_processing(__UpperCAmelCase ,						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.size["height"],
                 self.image_processor_tester.size["width"],
             ) ,						)


   def     lowercase_   (self  :		Tuple	)		->       Optional[Any]:
         """simple docstring"""



         UpperCAmelCase__			=						self.image_processing_class(**self.image_processor_dict	)
         # create random numpy tensors
         UpperCAmelCase__			=						prepare_image_inputs(self.image_processor_tester ,						equal_resolution=__UpperCAmelCase ,						numpify=__UpperCAmelCase	)
         for image in image_inputs:
               self.assertIsInstance(__UpperCAmelCase ,						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.size["height"],
                 self.image_processor_tester.size["width"],
             ) ,						)

         # Test batched
         UpperCAmelCase__			=						image_processing(__UpperCAmelCase ,						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.size["height"],
                 self.image_processor_tester.size["width"],
             ) ,						)





   def     lowercase_   (self  :		Optional[int]	)		->       str:
         """simple docstring"""



         UpperCAmelCase__			=						self.image_processing_class(**self.image_processor_dict	)
         # create random PyTorch tensors
         UpperCAmelCase__			=						prepare_image_inputs(self.image_processor_tester ,						equal_resolution=__UpperCAmelCase ,						torchify=__UpperCAmelCase	)
         for image in image_inputs:
               self.assertIsInstance(__UpperCAmelCase ,						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.size["height"],
                 self.image_processor_tester.size["width"],
             ) ,						)

         # Test batched
         UpperCAmelCase__			=						image_processing(__UpperCAmelCase ,						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.size["height"],
                 self.image_processor_tester.size["width"],
             ) ,						)



