


import random
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():
 import PIL

 from transformers import FlavaImageProcessor
 from transformers.image_utils import PILImageResampling
 from transformers.models.flava.image_processing_flava import (
     FLAVA_CODEBOOK_MEAN,
     FLAVA_CODEBOOK_STD,
     FLAVA_IMAGE_MEAN,
     FLAVA_IMAGE_STD,
 )
else:
 lowerCamelCase		      = lowerCamelCase		      = lowerCamelCase		      = lowerCamelCase		      = None




class A						(     unittest.TestCase  ):






      def __init__(      self		:  Optional[Any]    ,     lowercase_		:  Tuple    ,     lowercase_		:  str=7    ,     lowercase_		:  List[Any]=3    ,     lowercase_		:  Optional[int]=30    ,     lowercase_		:  List[Any]=400    ,     lowercase_		:  Union[str, Any]=True    ,     lowercase_		:  List[str]=None    ,     lowercase_		:  Union[str, Any]=True    ,     lowercase_		:  Optional[int]=None    ,     lowercase_		:  Tuple=None    ,     lowercase_		:  Any=True    ,     lowercase_		:  Optional[Any]=1 / 255    ,     lowercase_		:  Dict=True    ,     lowercase_		:  List[str]=FLAVA_IMAGE_MEAN    ,     lowercase_		:  Tuple=FLAVA_IMAGE_STD    ,     lowercase_		:  Union[str, Any]=14    ,     lowercase_		:  List[Any]=75    ,     lowercase_		:  Dict=None    ,     lowercase_		:  Tuple=16    ,     lowercase_		:  List[str]=0.3    ,     lowercase_		:  Dict=None    ,     lowercase_		:  Dict=True    ,     lowercase_		:  List[str]=None    ,     lowercase_		:  Any=None    ,     lowercase_		:  int=True    ,     lowercase_		:  Dict=None    ,     lowercase_		:  Tuple=True    ,     lowercase_		:  str=True    ,     lowercase_		:  Optional[Any]=FLAVA_CODEBOOK_MEAN    ,     lowercase_		:  str=FLAVA_CODEBOOK_STD    ,     )      ->		Dict:
             """simple docstring"""




             _lowerCamelCase :	int						=size if size is not None else {'height': 224, 'width': 224}
             _lowerCamelCase :	int						=crop_size if crop_size is not None else {'height': 224, 'width': 224}
             _lowerCamelCase :	Optional[int]						=codebook_size if codebook_size is not None else {'height': 112, 'width': 112}
             _lowerCamelCase :	List[Any]						=codebook_crop_size if codebook_crop_size is not None else {'height': 112, 'width': 112}

             _lowerCamelCase :	Optional[int]						=parent
             _lowerCamelCase :	int						=batch_size
             _lowerCamelCase :	Any						=num_channels
             _lowerCamelCase :	Optional[int]						=do_resize
             _lowerCamelCase :	Any						=do_rescale
             _lowerCamelCase :	Dict						=rescale_factor
             _lowerCamelCase :	Any						=min_resolution
             _lowerCamelCase :	Any						=max_resolution
             _lowerCamelCase :	Union[str, Any]						=size
             _lowerCamelCase :	Any						=resample if resample is not None else PILImageResampling.BICUBIC
             _lowerCamelCase :	int						=do_normalize
             _lowerCamelCase :	Optional[int]						=image_mean
             _lowerCamelCase :	Tuple						=image_std
             _lowerCamelCase :	Optional[Any]						=do_center_crop
             _lowerCamelCase :	Optional[Any]						=crop_size

             _lowerCamelCase :	str						=input_size_patches
             _lowerCamelCase :	int						=total_mask_patches
             _lowerCamelCase :	Optional[Any]						=mask_group_max_patches
             _lowerCamelCase :	List[Any]						=mask_group_min_patches
             _lowerCamelCase :	int						=mask_group_min_aspect_ratio
             _lowerCamelCase :	Optional[int]						=mask_group_max_aspect_ratio

             _lowerCamelCase :	List[Any]						=codebook_do_resize
             _lowerCamelCase :	List[Any]						=codebook_size
             _lowerCamelCase :	Optional[int]						=codebook_resample if codebook_resample is not None else PILImageResampling.LANCZOS
             _lowerCamelCase :	Any						=codebook_do_center_crop
             _lowerCamelCase :	Tuple						=codebook_crop_size
             _lowerCamelCase :	Optional[int]						=codebook_do_map_pixels
             _lowerCamelCase :	Any						=codebook_do_normalize
             _lowerCamelCase :	Dict						=codebook_image_mean
             _lowerCamelCase :	Union[str, Any]						=codebook_image_std






      def  lowerCamelCase (      self		:  Dict				)      ->		List[str]:
             """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,
                 "resample": self.resample,
                 "do_rescale": self.do_rescale,
                 "rescale_factor": self.rescale_factor,
                 "do_center_crop": self.do_center_crop,
                 "crop_size": self.crop_size,
                 "input_size_patches": self.input_size_patches,
                 "total_mask_patches": self.total_mask_patches,
                 "mask_group_max_patches": self.mask_group_max_patches,
                 "mask_group_min_patches": self.mask_group_min_patches,
                 "mask_group_min_aspect_ratio": self.mask_group_min_aspect_ratio,
                 "mask_group_max_aspect_ratio": self.mask_group_min_aspect_ratio,
                 "codebook_do_resize": self.codebook_do_resize,
                 "codebook_size": self.codebook_size,
                 "codebook_resample": self.codebook_resample,
                 "codebook_do_center_crop": self.codebook_do_center_crop,
                 "codebook_crop_size": self.codebook_crop_size,
                 "codebook_do_map_pixels": self.codebook_do_map_pixels,
                 "codebook_do_normalize": self.codebook_do_normalize,
                 "codebook_image_mean": self.codebook_image_mean,
                 "codebook_image_std": self.codebook_image_std,
             }






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




             return (self.size["height"], self.size["width"])






      def  lowerCamelCase (      self		:  str				)      ->		str:
             """simple docstring"""




             return (
                 (self.input_size_patches, self.input_size_patches)
                 if not isinstance(self.input_size_patches    ,     lowercase_				)
                 else self.input_size_patches
             )






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




             return (self.codebook_size["height"], self.codebook_size["width"])




@require_torch
@require_vision
class A						(     UpperCamelCase_					,							unittest.TestCase  ):
      UpperCamelCase__							:						str   =FlavaImageProcessor if is_vision_available() else None
      UpperCamelCase__							:						Any   =None






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




             _lowerCamelCase :	List[Any]						=FlavaImageProcessingTester(self				)






      @property
      def  lowerCamelCase (      self		:  List[Any]				)      ->		Any:
             """simple docstring"""




             return self.image_processor_tester.prepare_image_processor_dict()






      def  lowerCamelCase (      self		:  str				)      ->		List[Any]:
             """simple docstring"""




             _lowerCamelCase :	int						=self.image_processing_class(**self.image_processor_dict				)
             self.assertTrue(hasattr(lowercase_    ,     'image_mean'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'image_std'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'do_normalize'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'do_resize'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'resample'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'crop_size'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'do_center_crop'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'do_rescale'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'rescale_factor'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'masking_generator'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'codebook_do_resize'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'codebook_size'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'codebook_resample'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'codebook_do_center_crop'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'codebook_crop_size'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'codebook_do_map_pixels'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'codebook_do_normalize'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'codebook_image_mean'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'codebook_image_std'				)				)






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




             _lowerCamelCase :	List[Any]						=self.image_processing_class.from_dict(self.image_processor_dict				)
             self.assertEqual(image_processor.size    ,     {'height': 224, 'width': 224}				)
             self.assertEqual(image_processor.crop_size    ,     {'height': 224, 'width': 224}				)
             self.assertEqual(image_processor.codebook_size    ,     {'height': 112, 'width': 112}				)
             self.assertEqual(image_processor.codebook_crop_size    ,     {'height': 112, 'width': 112}				)

             _lowerCamelCase :	Dict						=self.image_processing_class.from_dict(
                 self.image_processor_dict    ,     size=42    ,     crop_size=84    ,     codebook_size=33    ,     codebook_crop_size=66				)
             self.assertEqual(image_processor.size    ,     {'height': 42, 'width': 42}				)
             self.assertEqual(image_processor.crop_size    ,     {'height': 84, 'width': 84}				)
             self.assertEqual(image_processor.codebook_size    ,     {'height': 33, 'width': 33}				)
             self.assertEqual(image_processor.codebook_crop_size    ,     {'height': 66, 'width': 66}				)






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




             pass






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




             _lowerCamelCase :	List[Any]						=self.image_processing_class(**self.image_processor_dict				)
             # create random PIL images
             _lowerCamelCase :	int						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_				)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_    ,     PIL.Image.Image				)

             # Test not batched input
             _lowerCamelCase :	int						=image_processing(image_inputs[0]    ,     return_tensors='pt'				)

             # Test no bool masked pos
             self.assertFalse('bool_masked_pos' in encoded_images				)

             _lowerCamelCase			,  _lowerCamelCase :	Union[str, Any]						=self.image_processor_tester.get_expected_image_size()

             self.assertEqual(
                 encoded_images.pixel_values.shape    ,     (1, self.image_processor_tester.num_channels, expected_height, expected_width)    ,     )

             # Test batched
             _lowerCamelCase :	List[Any]						=image_processing(lowercase_    ,     return_tensors='pt'				)
             _lowerCamelCase			,  _lowerCamelCase :	Tuple						=self.image_processor_tester.get_expected_image_size()

             # Test no bool masked pos
             self.assertFalse('bool_masked_pos' in encoded_images				)

             self.assertEqual(
                 encoded_images.pixel_values.shape    ,     (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_channels,
                     expected_height,
                     expected_width,
                 )    ,     )






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




             _lowerCamelCase :	List[str]						=self.image_processing_class(**self.image_processor_dict				)
             # create random tensors
             _lowerCamelCase :	Optional[int]						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_    ,     **lowercase_				)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_    ,     lowercase_				)

             # Test not batched input
             _lowerCamelCase :	Tuple						=image_processing(image_inputs[0]    ,     return_tensors='pt'				)

             _lowerCamelCase			,  _lowerCamelCase :	Union[str, Any]						=self.image_processor_tester.get_expected_image_size()
             self.assertEqual(
                 encoded_images.pixel_values.shape    ,     (1, self.image_processor_tester.num_channels, expected_height, expected_width)    ,     )

             _lowerCamelCase :	List[str]						=image_processing(lowercase_    ,     return_image_mask=lowercase_    ,     return_tensors='pt'				)

             _lowerCamelCase			,  _lowerCamelCase :	Optional[Any]						=self.image_processor_tester.get_expected_image_size()
             self.assertEqual(
                 encoded_images.pixel_values.shape    ,     (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_channels,
                     expected_height,
                     expected_width,
                 )    ,     )

             _lowerCamelCase			,  _lowerCamelCase :	Dict						=self.image_processor_tester.get_expected_mask_size()
             self.assertEqual(
                 encoded_images.bool_masked_pos.shape    ,     (
                     self.image_processor_tester.batch_size,
                     expected_height,
                     expected_width,
                 )    ,     )

             # Test batched
             _lowerCamelCase :	List[str]						=image_processing(lowercase_    ,     return_tensors='pt'				).pixel_values

             _lowerCamelCase			,  _lowerCamelCase :	Dict						=self.image_processor_tester.get_expected_image_size()
             self.assertEqual(
                 encoded_images.shape    ,     (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_channels,
                     expected_height,
                     expected_width,
                 )    ,     )

             # Test masking
             _lowerCamelCase :	List[Any]						=image_processing(lowercase_    ,     return_image_mask=lowercase_    ,     return_tensors='pt'				)

             _lowerCamelCase			,  _lowerCamelCase :	int						=self.image_processor_tester.get_expected_image_size()
             self.assertEqual(
                 encoded_images.pixel_values.shape    ,     (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_channels,
                     expected_height,
                     expected_width,
                 )    ,     )

             _lowerCamelCase			,  _lowerCamelCase :	int						=self.image_processor_tester.get_expected_mask_size()
             self.assertEqual(
                 encoded_images.bool_masked_pos.shape    ,     (
                     self.image_processor_tester.batch_size,
                     expected_height,
                     expected_width,
                 )    ,     )






      def  lowerCamelCase (      self		:  int				)      ->		int:
             """simple docstring"""




             self._test_call_framework(np.ndarray    ,     prepare_kwargs={'numpify': True}				)






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




             self._test_call_framework(torch.Tensor    ,     prepare_kwargs={'torchify': True}				)






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




             random.seed(1234				)
             _lowerCamelCase :	Optional[int]						=self.image_processing_class(**self.image_processor_dict				)
             _lowerCamelCase :	List[str]						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_    ,     torchify=lowercase_				)

             # Test not batched input
             _lowerCamelCase :	Optional[Any]						=image_processing(image_inputs[0]    ,     return_image_mask=lowercase_    ,     return_tensors='pt'				)
             self.assertEqual(encoded_images.bool_masked_pos.sum().item()    ,     75				)






      def  lowerCamelCase (      self		:  List[str]				)      ->		Dict:
             """simple docstring"""




             _lowerCamelCase :	Union[str, Any]						=self.image_processing_class(**self.image_processor_dict				)
             # create random PIL images
             _lowerCamelCase :	Tuple						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_				)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_    ,     PIL.Image.Image				)

             # Test not batched input
             _lowerCamelCase :	List[Any]						=image_processing(image_inputs[0]    ,     return_codebook_pixels=lowercase_    ,     return_tensors='pt'				)
             _lowerCamelCase			,  _lowerCamelCase :	Any						=self.image_processor_tester.get_expected_codebook_image_size()
             self.assertEqual(
                 encoded_images.codebook_pixel_values.shape    ,     (1, self.image_processor_tester.num_channels, expected_height, expected_width)    ,     )

             # Test batched
             _lowerCamelCase :	str						=image_processing(lowercase_    ,     return_codebook_pixels=lowercase_    ,     return_tensors='pt'				)
             _lowerCamelCase			,  _lowerCamelCase :	str						=self.image_processor_tester.get_expected_codebook_image_size()
             self.assertEqual(
                 encoded_images.codebook_pixel_values.shape    ,     (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_channels,
                     expected_height,
                     expected_width,
                 )    ,     )






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 ConvNextImageProcessor




class A						(     unittest.TestCase  ):






      def __init__(      self		:  Optional[Any]    ,     lowercase_		:  str    ,     lowercase_		:  Tuple=7    ,     lowercase_		:  int=3    ,     lowercase_		:  Union[str, Any]=18    ,     lowercase_		:  Optional[int]=30    ,     lowercase_		:  Tuple=400    ,     lowercase_		:  str=True    ,     lowercase_		:  Dict=None    ,     lowercase_		:  Tuple=0.875    ,     lowercase_		:  List[Any]=True    ,     lowercase_		:  Union[str, Any]=[0.5, 0.5, 0.5]    ,     lowercase_		:  List[str]=[0.5, 0.5, 0.5]    ,     )      ->		Any:
             """simple docstring"""




             _lowerCamelCase :	Optional[Any]						=size if size is not None else {'shortest_edge': 20}
             _lowerCamelCase :	Optional[Any]						=parent
             _lowerCamelCase :	Union[str, Any]						=batch_size
             _lowerCamelCase :	Dict						=num_channels
             _lowerCamelCase :	Union[str, Any]						=image_size
             _lowerCamelCase :	Optional[int]						=min_resolution
             _lowerCamelCase :	Tuple						=max_resolution
             _lowerCamelCase :	Any						=do_resize
             _lowerCamelCase :	Dict						=size
             _lowerCamelCase :	int						=crop_pct
             _lowerCamelCase :	Dict						=do_normalize
             _lowerCamelCase :	int						=image_mean
             _lowerCamelCase :	Union[str, Any]						=image_std






      def  lowerCamelCase (      self		:  List[str]				)      ->		int:
             """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_pct": self.crop_pct,
             }




@require_torch
@require_vision
class A						(     UpperCamelCase_					,							unittest.TestCase  ):
      UpperCamelCase__							:						List[Any]   =ConvNextImageProcessor if is_vision_available() else None






      def  lowerCamelCase (      self		:  List[str]				)      ->		Tuple:
             """simple docstring"""




             _lowerCamelCase :	Optional[Any]						=ConvNextImageProcessingTester(self				)






      @property
      def  lowerCamelCase (      self		:  List[str]				)      ->		int:
             """simple docstring"""




             return self.image_processor_tester.prepare_image_processor_dict()






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




             _lowerCamelCase :	Dict						=self.image_processing_class(**self.image_processor_dict				)
             self.assertTrue(hasattr(lowercase_    ,     'do_resize'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'size'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'crop_pct'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'do_normalize'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'image_mean'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'image_std'				)				)






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




             _lowerCamelCase :	Tuple						=self.image_processing_class.from_dict(self.image_processor_dict				)
             self.assertEqual(image_processor.size    ,     {'shortest_edge': 20}				)

             _lowerCamelCase :	Tuple						=self.image_processing_class.from_dict(self.image_processor_dict    ,     size=42				)
             self.assertEqual(image_processor.size    ,     {'shortest_edge': 42}				)






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




             pass






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




             _lowerCamelCase :	Optional[Any]						=self.image_processing_class(**self.image_processor_dict				)
             # create random PIL images
             _lowerCamelCase :	Any						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_				)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_    ,     Image.Image				)

             # Test not batched input
             _lowerCamelCase :	Tuple						=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['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )

             # Test batched
             _lowerCamelCase :	List[str]						=image_processing(lowercase_    ,     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['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )






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




             _lowerCamelCase :	Optional[int]						=self.image_processing_class(**self.image_processor_dict				)
             # create random numpy tensors
             _lowerCamelCase :	List[Any]						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_    ,     numpify=lowercase_				)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_    ,     np.ndarray				)

             # Test not batched input
             _lowerCamelCase :	Optional[Any]						=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['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )

             # Test batched
             _lowerCamelCase :	Any						=image_processing(lowercase_    ,     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['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )






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




             _lowerCamelCase :	List[Any]						=self.image_processing_class(**self.image_processor_dict				)
             # create random PyTorch tensors
             _lowerCamelCase :	Any						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_    ,     torchify=lowercase_				)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_    ,     torch.Tensor				)

             # Test not batched input
             _lowerCamelCase :	Optional[Any]						=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['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )

             # Test batched
             _lowerCamelCase :	Union[str, Any]						=image_processing(lowercase_    ,     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['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )


