
"""simple docstring"""



import gc
import random
import unittest

import numpy as np
import torch
from PIL import Image

from diffusers import (
    DDIMScheduler,
    KandinskyVaaControlnetImgaImgPipeline,
    KandinskyVaaPriorEmbaEmbPipeline,
    UNetaDConditionModel,
    VQModel,
)
from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu

from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference


enable_full_determinism()
class        _SCREAMING_SNAKE_CASE  (  UpperCAmelCase      ,				unittest.TestCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Optional[int]							=					KandinskyVaaControlnetImgaImgPipeline
				SCREAMING_SNAKE_CASE_:							Optional[Any]							=					["image_embeds", "negative_image_embeds", "image", "hint"]
				SCREAMING_SNAKE_CASE_:							Tuple							=					["image_embeds", "negative_image_embeds", "image", "hint"]
				SCREAMING_SNAKE_CASE_:							Any							=					[
				    "generator",
				    "height",
				    "width",
				    "strength",
				    "guidance_scale",
				    "num_inference_steps",
				    "return_dict",
				    "guidance_scale",
				    "num_images_per_prompt",
				    "output_type",
				    "return_dict",
				]
				SCREAMING_SNAKE_CASE_:							str							=					False


				@property
				def 				__lowerCamelCase	(					self	:			int  )		->  Optional[int]:







											"""simple docstring"""




											return 32


				@property
				def 				__lowerCamelCase	(					self	:			Optional[Any]  )		->  int:







											"""simple docstring"""




											return 32


				@property
				def 				__lowerCamelCase	(					self	:			Union[str, Any]  )		->  List[str]:







											"""simple docstring"""




											return self.time_input_dim


				@property
				def 				__lowerCamelCase	(					self	:			List[Any]  )		->  Tuple:







											"""simple docstring"""




											return self.time_input_dim * 4


				@property
				def 				__lowerCamelCase	(					self	:			Optional[int]  )		->  int:







											"""simple docstring"""




											return 100


				@property
				def 				__lowerCamelCase	(					self	:			Dict  )		->  Tuple:







											"""simple docstring"""




											torch.manual_seed(0  )

											_lowerCAmelCase  	=			{
											    'in_channels': 8,
											    # Out channels is double in channels because predicts mean and variance
											    'out_channels': 8,
											    'addition_embed_type': 'image_hint',
											    'down_block_types': ('ResnetDownsampleBlock2D', 'SimpleCrossAttnDownBlock2D'),
											    'up_block_types': ('SimpleCrossAttnUpBlock2D', 'ResnetUpsampleBlock2D'),
											    'mid_block_type': 'UNetMidBlock2DSimpleCrossAttn',
											    'block_out_channels': (self.block_out_channels_a, self.block_out_channels_a * 2),
											    'layers_per_block': 1,
											    'encoder_hid_dim': self.text_embedder_hidden_size,
											    'encoder_hid_dim_type': 'image_proj',
											    'cross_attention_dim': self.cross_attention_dim,
											    'attention_head_dim': 4,
											    'resnet_time_scale_shift': 'scale_shift',
											    'class_embed_type': None,
											}

											_lowerCAmelCase  	=			UNetaDConditionModel(**UpperCAmelCase_  )
											return model


				@property
				def 				__lowerCamelCase	(					self	:			str  )		->  Tuple:







											"""simple docstring"""




											return {
											    "block_out_channels": [32, 32, 64, 64],
											    "down_block_types": [
											        "DownEncoderBlock2D",
											        "DownEncoderBlock2D",
											        "DownEncoderBlock2D",
											        "AttnDownEncoderBlock2D",
											    ],
											    "in_channels": 3,
											    "latent_channels": 4,
											    "layers_per_block": 1,
											    "norm_num_groups": 8,
											    "norm_type": "spatial",
											    "num_vq_embeddings": 12,
											    "out_channels": 3,
											    "up_block_types": ["AttnUpDecoderBlock2D", "UpDecoderBlock2D", "UpDecoderBlock2D", "UpDecoderBlock2D"],
											    "vq_embed_dim": 4,
											}


				@property
				def 				__lowerCamelCase	(					self	:			str  )		->  Dict:







											"""simple docstring"""




											torch.manual_seed(0  )
											_lowerCAmelCase  	=			VQModel(**self.dummy_movq_kwargs  )
											return model


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







											"""simple docstring"""




											_lowerCAmelCase  	=			self.dummy_unet
											_lowerCAmelCase  	=			self.dummy_movq

											_lowerCAmelCase  	=			{
											    'num_train_timesteps': 1_000,
											    'beta_schedule': 'linear',
											    'beta_start': 0.00085,
											    'beta_end': 0.012,
											    'clip_sample': False,
											    'set_alpha_to_one': False,
											    'steps_offset': 0,
											    'prediction_type': 'epsilon',
											    'thresholding': False,
											}

											_lowerCAmelCase  	=			DDIMScheduler(**UpperCAmelCase_  )

											_lowerCAmelCase  	=			{
											    'unet': unet,
											    'scheduler': scheduler,
											    'movq': movq,
											}

											return components


				def 				__lowerCamelCase	(					self	:			Dict				,     UpperCAmelCase_	:			Union[str, Any]				,     UpperCAmelCase_	:			Any=0  )		->  List[str]:







											"""simple docstring"""




											_lowerCAmelCase  	=			floats_tensor((1, self.text_embedder_hidden_size)				,     rng=random.Random(UpperCAmelCase_  )  ).to(UpperCAmelCase_  )
											_lowerCAmelCase  	=			floats_tensor((1, self.text_embedder_hidden_size)				,     rng=random.Random(seed + 1  )  ).to(
											    UpperCAmelCase_  )
											# create init_image
											_lowerCAmelCase  	=			floats_tensor((1, 3, 64, 64)				,     rng=random.Random(UpperCAmelCase_  )  ).to(UpperCAmelCase_  )
											_lowerCAmelCase  	=			image.cpu().permute(0				,     2				,     3				,     1  )[0]
											_lowerCAmelCase  	=			Image.fromarray(np.uinta(UpperCAmelCase_  )  ).convert('RGB'  ).resize((256, 256)  )
											# create hint
											_lowerCAmelCase  	=			floats_tensor((1, 3, 64, 64)				,     rng=random.Random(UpperCAmelCase_  )  ).to(UpperCAmelCase_  )

											if str(UpperCAmelCase_  ).startswith('mps'  ):
																		_lowerCAmelCase  	=			torch.manual_seed(UpperCAmelCase_  )
											else:
																		_lowerCAmelCase  	=			torch.Generator(device=UpperCAmelCase_  ).manual_seed(UpperCAmelCase_  )
											_lowerCAmelCase  	=			{
											    'image': init_image,
											    'image_embeds': image_embeds,
											    'negative_image_embeds': negative_image_embeds,
											    'hint': hint,
											    'generator': generator,
											    'height': 64,
											    'width': 64,
											    'num_inference_steps': 10,
											    'guidance_scale': 7.0,
											    'strength': 0.2,
											    'output_type': 'np',
											}
											return inputs







				def 				__lowerCamelCase	(					self	:			Tuple  )		->  Dict:







											"""simple docstring"""




											_lowerCAmelCase  	=			'cpu'

											_lowerCAmelCase  	=			self.get_dummy_components()

											_lowerCAmelCase  	=			self.pipeline_class(**UpperCAmelCase_  )
											_lowerCAmelCase  	=			pipe.to(UpperCAmelCase_  )

											pipe.set_progress_bar_config(disable=UpperCAmelCase_  )

											_lowerCAmelCase  	=			pipe(**self.get_dummy_inputs(UpperCAmelCase_  )  )
											_lowerCAmelCase  	=			output.images

											_lowerCAmelCase  	=			pipe(
											    **self.get_dummy_inputs(UpperCAmelCase_  )				,     return_dict=UpperCAmelCase_				,     )[0]

											_lowerCAmelCase  	=			image[0, -3:, -3:, -1]
											_lowerCAmelCase  	=			image_from_tuple[0, -3:, -3:, -1]

											assert image.shape == (1, 64, 64, 3)

											_lowerCAmelCase  	=			np.array(
											    [0.54985034, 0.55509365, 0.52561504, 0.5570494, 0.5593818, 0.5263979, 0.50285643, 0.5069846, 0.51196736]  )
											assert (
											    np.abs(image_slice.flatten() - expected_slice  ).max() < 1E-2
											), F""" expected_slice {expected_slice}, but got {image_slice.flatten()}"""
											assert (
											    np.abs(image_from_tuple_slice.flatten() - expected_slice  ).max() < 1E-2
											), F""" expected_slice {expected_slice}, but got {image_from_tuple_slice.flatten()}"""






@slow
@require_torch_gpu
class        _SCREAMING_SNAKE_CASE  (  unittest.TestCase							):






				'''simple docstring'''



				def 				__lowerCamelCase	(					self	:			Tuple  )		->  Optional[Any]:







											"""simple docstring"""




											super().tearDown()
											gc.collect()
											torch.cuda.empty_cache()







				def 				__lowerCamelCase	(					self	:			Tuple  )		->  List[str]:







											"""simple docstring"""




											_lowerCAmelCase  	=			load_numpy(
											    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
											    '/kandinskyv22/kandinskyv22_controlnet_img2img_robotcat_fp16.npy'  )

											_lowerCAmelCase  	=			load_image(
											    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main' '/kandinsky/cat.png'  )
											_lowerCAmelCase  	=			init_image.resize((512, 512)  )

											_lowerCAmelCase  	=			load_image(
											    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
											    '/kandinskyv22/hint_image_cat.png'  )
											_lowerCAmelCase  	=			torch.from_numpy(np.array(UpperCAmelCase_  )  ).float() / 255.0
											_lowerCAmelCase  	=			hint.permute(2				,     0				,     1  ).unsqueeze(0  )

											_lowerCAmelCase  	=			'A robot, 4k photo'

											_lowerCAmelCase  	=			KandinskyVaaPriorEmbaEmbPipeline.from_pretrained(
											    'kandinsky-community/kandinsky-2-2-prior'				,     torch_dtype=torch.floataa  )
											pipe_prior.to(UpperCAmelCase_  )

											_lowerCAmelCase  	=			KandinskyVaaControlnetImgaImgPipeline.from_pretrained(
											    'kandinsky-community/kandinsky-2-2-controlnet-depth'				,     torch_dtype=torch.floataa  )
											_lowerCAmelCase  	=			pipeline.to(UpperCAmelCase_  )

											pipeline.set_progress_bar_config(disable=UpperCAmelCase_  )

											_lowerCAmelCase  	=			torch.Generator(device='cpu'  ).manual_seed(0  )

											_lowerCAmelCase	,		_lowerCAmelCase  	=			pipe_prior(
											    UpperCAmelCase_				,     image=UpperCAmelCase_				,     strength=0.85				,     generator=UpperCAmelCase_				,     negative_prompt=''				,     ).to_tuple()

											_lowerCAmelCase  	=			pipeline(
											    image=UpperCAmelCase_				,     image_embeds=UpperCAmelCase_				,     negative_image_embeds=UpperCAmelCase_				,     hint=UpperCAmelCase_				,     generator=UpperCAmelCase_				,     num_inference_steps=100				,     height=512				,     width=512				,     strength=0.5				,     output_type='np'				,     )

											_lowerCAmelCase  	=			output.images[0]

											assert image.shape == (512, 512, 3)

											assert_mean_pixel_difference(UpperCAmelCase_				,     UpperCAmelCase_  )








"""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


if is_torch_available():
	import torch

if is_vision_available():
	from PIL import Image

	from transformers import ChineseCLIPImageProcessor
class        _SCREAMING_SNAKE_CASE  (  unittest.TestCase							):






				'''simple docstring'''



				def __init__(					self	:			Optional[Any]				,     UpperCAmelCase_	:			int				,     UpperCAmelCase_	:			Dict=7				,     UpperCAmelCase_	:			List[Any]=3				,     UpperCAmelCase_	:			Tuple=18				,     UpperCAmelCase_	:			List[str]=30				,     UpperCAmelCase_	:			Union[str, Any]=400				,     UpperCAmelCase_	:			Optional[Any]=True				,     UpperCAmelCase_	:			Tuple=None				,     UpperCAmelCase_	:			Optional[int]=True				,     UpperCAmelCase_	:			Any=None				,     UpperCAmelCase_	:			Tuple=True				,     UpperCAmelCase_	:			List[Any]=[0.48145466, 0.4578275, 0.40821073]				,     UpperCAmelCase_	:			List[Any]=[0.26862954, 0.26130258, 0.27577711]				,     UpperCAmelCase_	:			Optional[int]=True				,     )		->  Tuple:







											"""simple docstring"""




											_lowerCAmelCase  	=			size if size is not None else {'height': 224, 'width': 224}
											_lowerCAmelCase  	=			crop_size if crop_size is not None else {'height': 18, 'width': 18}
											_lowerCAmelCase  	=			parent
											_lowerCAmelCase  	=			batch_size
											_lowerCAmelCase  	=			num_channels
											_lowerCAmelCase  	=			image_size
											_lowerCAmelCase  	=			min_resolution
											_lowerCAmelCase  	=			max_resolution
											_lowerCAmelCase  	=			do_resize
											_lowerCAmelCase  	=			size
											_lowerCAmelCase  	=			do_center_crop
											_lowerCAmelCase  	=			crop_size
											_lowerCAmelCase  	=			do_normalize
											_lowerCAmelCase  	=			image_mean
											_lowerCAmelCase  	=			image_std
											_lowerCAmelCase  	=			do_convert_rgb


				def 				__lowerCamelCase	(					self	:			Optional[int]  )		->  int:







											"""simple docstring"""




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







				def 				__lowerCamelCase	(					self	:			Dict				,     UpperCAmelCase_	:			Dict=False				,     UpperCAmelCase_	:			int=False				,     UpperCAmelCase_	:			Dict=False  )		->  str:







											"""simple docstring"""




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

											if equal_resolution:
																		_lowerCAmelCase  	=			[]
																		for i in range(self.batch_size  ):
																									image_inputs.append(
																									    np.random.randint(
																									        255				,     size=(self.num_channels, self.max_resolution, self.max_resolution)				,     dtype=np.uinta  )  )
											else:
																		_lowerCAmelCase  	=			[]
																		for i in range(self.batch_size  ):
																									_lowerCAmelCase	,		_lowerCAmelCase  	=			np.random.choice(np.arange(self.min_resolution				,     self.max_resolution  )				,     2  )
																									image_inputs.append(np.random.randint(255				,     size=(self.num_channels, width, height)				,     dtype=np.uinta  )  )

											if not numpify and not torchify:
																		# PIL expects the channel dimension as last dimension
																		_lowerCAmelCase  	=			[Image.fromarray(np.moveaxis(UpperCAmelCase_				,     0				,     -1  )  ) for x in image_inputs]

											if torchify:
																		_lowerCAmelCase  	=			[torch.from_numpy(UpperCAmelCase_  ) for x in image_inputs]

											return image_inputs






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






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							List[Any]							=					ChineseCLIPImageProcessor if is_vision_available() else None


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







											"""simple docstring"""




											_lowerCAmelCase  	=			ChineseCLIPImageProcessingTester(self				,     do_center_crop=UpperCAmelCase_  )


				@property
				def 				__lowerCamelCase	(					self	:			Union[str, Any]  )		->  int:







											"""simple docstring"""




											return self.image_processor_tester.prepare_image_processor_dict()


				def 				__lowerCamelCase	(					self	:			List[str]  )		->  Optional[Any]:







											"""simple docstring"""




											_lowerCAmelCase  	=			self.image_processing_class(**self.image_processor_dict  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'do_resize'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'size'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'do_center_crop'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'center_crop'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'do_normalize'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'image_mean'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'image_std'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'do_convert_rgb'  )  )


				def 				__lowerCamelCase	(					self	:			Dict  )		->  Tuple:







											"""simple docstring"""




											_lowerCAmelCase  	=			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': 18, 'width': 18}  )

											_lowerCAmelCase  	=			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	:			Union[str, Any]  )		->  List[str]:







											"""simple docstring"""




											pass


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







											"""simple docstring"""




											_lowerCAmelCase  	=			self.image_processing_class(**self.image_processor_dict  )
											# create random PIL images
											_lowerCAmelCase  	=			self.image_processor_tester.prepare_inputs(equal_resolution=UpperCAmelCase_  )
											for image in image_inputs:
																		self.assertIsInstance(UpperCAmelCase_				,     Image.Image  )

											# Test not batched input
											_lowerCAmelCase  	=			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
											_lowerCAmelCase  	=			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.crop_size['height'],
											        self.image_processor_tester.crop_size['width'],
											    )				,     )


				def 				__lowerCamelCase	(					self	:			List[str]  )		->  int:







											"""simple docstring"""




											_lowerCAmelCase  	=			self.image_processing_class(**self.image_processor_dict  )
											# create random numpy tensors
											_lowerCAmelCase  	=			self.image_processor_tester.prepare_inputs(equal_resolution=UpperCAmelCase_				,     numpify=UpperCAmelCase_  )
											for image in image_inputs:
																		self.assertIsInstance(UpperCAmelCase_				,     np.ndarray  )

											# Test not batched input
											_lowerCAmelCase  	=			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
											_lowerCAmelCase  	=			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.crop_size['height'],
											        self.image_processor_tester.crop_size['width'],
											    )				,     )







				def 				__lowerCamelCase	(					self	:			List[Any]  )		->  Dict:







											"""simple docstring"""




											_lowerCAmelCase  	=			self.image_processing_class(**self.image_processor_dict  )
											# create random PyTorch tensors
											_lowerCAmelCase  	=			self.image_processor_tester.prepare_inputs(equal_resolution=UpperCAmelCase_				,     torchify=UpperCAmelCase_  )
											for image in image_inputs:
																		self.assertIsInstance(UpperCAmelCase_				,     torch.Tensor  )

											# Test not batched input
											_lowerCAmelCase  	=			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
											_lowerCAmelCase  	=			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.crop_size['height'],
											        self.image_processor_tester.crop_size['width'],
											    )				,     )






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






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							str							=					ChineseCLIPImageProcessor if is_vision_available() else None


				def 				__lowerCamelCase	(					self	:			List[str]  )		->  List[Any]:







											"""simple docstring"""




											_lowerCAmelCase  	=			ChineseCLIPImageProcessingTester(self				,     num_channels=4				,     do_center_crop=UpperCAmelCase_  )
											_lowerCAmelCase  	=			3


				@property
				def 				__lowerCamelCase	(					self	:			Union[str, Any]  )		->  Dict:







											"""simple docstring"""




											return self.image_processor_tester.prepare_image_processor_dict()


				def 				__lowerCamelCase	(					self	:			Optional[Any]  )		->  Dict:







											"""simple docstring"""




											_lowerCAmelCase  	=			self.image_processing_class(**self.image_processor_dict  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'do_resize'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'size'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'do_center_crop'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'center_crop'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'do_normalize'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'image_mean'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'image_std'  )  )
											self.assertTrue(hasattr(UpperCAmelCase_				,     'do_convert_rgb'  )  )


				def 				__lowerCamelCase	(					self	:			List[Any]  )		->  Optional[int]:







											"""simple docstring"""




											pass







				def 				__lowerCamelCase	(					self	:			int  )		->  List[Any]:







											"""simple docstring"""




											_lowerCAmelCase  	=			self.image_processing_class(**self.image_processor_dict  )
											# create random PIL images
											_lowerCAmelCase  	=			self.image_processor_tester.prepare_inputs(equal_resolution=UpperCAmelCase_  )
											for image in image_inputs:
																		self.assertIsInstance(UpperCAmelCase_				,     Image.Image  )

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

											# Test batched
											_lowerCAmelCase  	=			image_processing(UpperCAmelCase_				,     return_tensors='pt'  ).pixel_values
											self.assertEqual(
											    encoded_images.shape				,     (
											        self.image_processor_tester.batch_size,
											        self.expected_encoded_image_num_channels,
											        self.image_processor_tester.crop_size['height'],
											        self.image_processor_tester.crop_size['width'],
											    )				,     )






