






from typing import Optional, Tuple, Union

import flax
import flax.linen as nn
import jax
import jax.numpy as jnp
from flax.core.frozen_dict import FrozenDict

from ..configuration_utils import ConfigMixin, flax_register_to_config
from ..utils import BaseOutput
from .embeddings_flax import FlaxTimestepEmbedding, FlaxTimesteps
from .modeling_flax_utils import FlaxModelMixin
from .unet_ad_blocks_flax import (
    FlaxCrossAttnDownBlockaD,
    FlaxDownBlockaD,
    FlaxUNetMidBlockaDCrossAttn,
)


@flax.struct.dataclass
class  SCREAMING_SNAKE_CASE			(			lowerCAmelCase					):
     '''simple docstring'''


     UpperCamelCase_							:		jnp.ndarray
     UpperCamelCase_							:		jnp.ndarray





class  SCREAMING_SNAKE_CASE			(			nn.Module					):
     '''simple docstring'''


     UpperCamelCase_							:		int
     UpperCamelCase_							:		Tuple[int]			=	(1_6, 3_2, 9_6, 2_5_6)
     UpperCamelCase_							:		jnp.dtype			=	jnp.floataa


     def 				_A       (				self       :	Optional[int]      ):
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    nn.Conv(
           self.block_out_channels[0]					, kernel_size=(3, 3)					, padding=((1, 1), (1, 1))					, dtype=self.dtype					, )

       SCREAMING_SNAKE_CASE       :      str							=    []
       for i in range(len(self.block_out_channels      ) - 1      ):
         SCREAMING_SNAKE_CASE       :      Optional[Any]							=    self.block_out_channels[i]
         SCREAMING_SNAKE_CASE       :      Optional[int]							=    self.block_out_channels[i + 1]
         SCREAMING_SNAKE_CASE       :      str							=    nn.Conv(
             UpperCAmelCase_					, kernel_size=(3, 3)					, padding=((1, 1), (1, 1))					, dtype=self.dtype					, )
         blocks.append(UpperCAmelCase_      )
         SCREAMING_SNAKE_CASE       :      Dict							=    nn.Conv(
             UpperCAmelCase_					, kernel_size=(3, 3)					, strides=(2, 2)					, padding=((1, 1), (1, 1))					, dtype=self.dtype					, )
         blocks.append(UpperCAmelCase_      )
       SCREAMING_SNAKE_CASE       :      List[Any]							=    blocks

       SCREAMING_SNAKE_CASE       :      str							=    nn.Conv(
           self.conditioning_embedding_channels					, kernel_size=(3, 3)					, padding=((1, 1), (1, 1))					, kernel_init=nn.initializers.zeros_init()					, bias_init=nn.initializers.zeros_init()					, dtype=self.dtype					, )






     def __call__(				self       :	int					, UpperCAmelCase_       :	List[str]      ):
       SCREAMING_SNAKE_CASE       :      Tuple							=    self.conv_in(UpperCAmelCase_      )
       SCREAMING_SNAKE_CASE       :      Tuple							=    nn.silu(UpperCAmelCase_      )

       for block in self.blocks:
         SCREAMING_SNAKE_CASE       :      Optional[Any]							=    block(UpperCAmelCase_      )
         SCREAMING_SNAKE_CASE       :      Optional[Any]							=    nn.silu(UpperCAmelCase_      )

       SCREAMING_SNAKE_CASE       :      Dict							=    self.conv_out(UpperCAmelCase_      )

       return embedding





@flax_register_to_config
class  SCREAMING_SNAKE_CASE			(			nn.Module      ,		lowerCAmelCase      ,		lowerCAmelCase					):
     '''simple docstring'''


     UpperCamelCase_							:		int			=	3_2
     UpperCamelCase_							:		int			=	4
     UpperCamelCase_							:		Tuple[str]			=	(
         "CrossAttnDownBlock2D",
         "CrossAttnDownBlock2D",
         "CrossAttnDownBlock2D",
         "DownBlock2D",
     )
     UpperCamelCase_							:		Union[bool, Tuple[bool]]			=	False
     UpperCamelCase_							:		Tuple[int]			=	(3_2_0, 6_4_0, 1_2_8_0, 1_2_8_0)
     UpperCamelCase_							:		int			=	2
     UpperCamelCase_							:		Union[int, Tuple[int]]			=	8
     UpperCamelCase_							:		Optional[Union[int, Tuple[int]]]			=	None
     UpperCamelCase_							:		int			=	1_2_8_0
     UpperCamelCase_							:		float			=	0.0
     UpperCamelCase_							:		bool			=	False
     UpperCamelCase_							:		jnp.dtype			=	jnp.floataa
     UpperCamelCase_							:		bool			=	True
     UpperCamelCase_							:		int			=	0
     UpperCamelCase_							:		str			=	"rgb"
     UpperCamelCase_							:		Tuple[int]			=	(1_6, 3_2, 9_6, 2_5_6)


     def 				_A       (				self       :	Any					, UpperCAmelCase_       :	jax.random.KeyArray      ):
       # init input tensors
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    (1, self.in_channels, self.sample_size, self.sample_size)
       SCREAMING_SNAKE_CASE       :      Tuple							=    jnp.zeros(UpperCAmelCase_					, dtype=jnp.floataa      )
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    jnp.ones((1,)					, dtype=jnp.intaa      )
       SCREAMING_SNAKE_CASE       :      str							=    jnp.zeros((1, 1, self.cross_attention_dim)					, dtype=jnp.floataa      )
       SCREAMING_SNAKE_CASE       :      Dict							=    (1, 3, self.sample_size * 8, self.sample_size * 8)
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    jnp.zeros(UpperCAmelCase_					, dtype=jnp.floataa      )

       SCREAMING_SNAKE_CASE						,  SCREAMING_SNAKE_CASE       :      Optional[int]							=    jax.random.split(UpperCAmelCase_      )
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    {"params": params_rng, "dropout": dropout_rng}

       return self.init(UpperCAmelCase_					, UpperCAmelCase_					, UpperCAmelCase_					, UpperCAmelCase_					, UpperCAmelCase_      )["params"]


     def 				_A       (				self       :	Dict      ):
       SCREAMING_SNAKE_CASE       :      int							=    self.block_out_channels
       SCREAMING_SNAKE_CASE       :      List[str]							=    block_out_channels[0] * 4

       # If `num_attention_heads` is not defined (which is the case for most models)
       # it will default to `attention_head_dim`. This looks weird upon first reading it and it is.
       # The reason for this behavior is to correct for incorrectly named variables that were introduced
       # when this library was created. The incorrect naming was only discovered much later in https://github.com/huggingface/diffusers/issues/2011#issuecomment-1547958131
       # Changing `attention_head_dim` to `num_attention_heads` for 40,000+ configurations is too backwards breaking
       # which is why we correct for the naming here.
       SCREAMING_SNAKE_CASE       :      List[str]							=    self.num_attention_heads or self.attention_head_dim

       # input
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    nn.Conv(
           block_out_channels[0]					, kernel_size=(3, 3)					, strides=(1, 1)					, padding=((1, 1), (1, 1))					, dtype=self.dtype					, )

       # time
       SCREAMING_SNAKE_CASE       :      Dict							=    FlaxTimesteps(
           block_out_channels[0]					, flip_sin_to_cos=self.flip_sin_to_cos					, freq_shift=self.config.freq_shift      )
       SCREAMING_SNAKE_CASE       :      str							=    FlaxTimestepEmbedding(UpperCAmelCase_					, dtype=self.dtype      )

       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    FlaxControlNetConditioningEmbedding(
           conditioning_embedding_channels=block_out_channels[0]					, block_out_channels=self.conditioning_embedding_out_channels					, )

       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    self.only_cross_attention
       if isinstance(UpperCAmelCase_					, UpperCAmelCase_      ):
         SCREAMING_SNAKE_CASE       :      str							=    (only_cross_attention,) * len(self.down_block_types      )

       if isinstance(UpperCAmelCase_					, UpperCAmelCase_      ):
         SCREAMING_SNAKE_CASE       :      str							=    (num_attention_heads,) * len(self.down_block_types      )

       # down
       SCREAMING_SNAKE_CASE       :      List[str]							=    []
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    []

       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    block_out_channels[0]

       SCREAMING_SNAKE_CASE       :      Tuple							=    nn.Conv(
           UpperCAmelCase_					, kernel_size=(1, 1)					, padding="VALID"					, kernel_init=nn.initializers.zeros_init()					, bias_init=nn.initializers.zeros_init()					, dtype=self.dtype					, )
       controlnet_down_blocks.append(UpperCAmelCase_      )

       for i, down_block_type in enumerate(self.down_block_types      ):
         SCREAMING_SNAKE_CASE       :      str							=    output_channel
         SCREAMING_SNAKE_CASE       :      List[Any]							=    block_out_channels[i]
         SCREAMING_SNAKE_CASE       :      List[str]							=    i == len(UpperCAmelCase_      ) - 1

         if down_block_type == "CrossAttnDownBlock2D":
           SCREAMING_SNAKE_CASE       :      Any							=    FlaxCrossAttnDownBlockaD(
               in_channels=UpperCAmelCase_					, out_channels=UpperCAmelCase_					, dropout=self.dropout					, num_layers=self.layers_per_block					, num_attention_heads=num_attention_heads[i]					, add_downsample=not is_final_block					, use_linear_projection=self.use_linear_projection					, only_cross_attention=only_cross_attention[i]					, dtype=self.dtype					, )
         else:
           SCREAMING_SNAKE_CASE       :      int							=    FlaxDownBlockaD(
               in_channels=UpperCAmelCase_					, out_channels=UpperCAmelCase_					, dropout=self.dropout					, num_layers=self.layers_per_block					, add_downsample=not is_final_block					, dtype=self.dtype					, )

         down_blocks.append(UpperCAmelCase_      )

         for _ in range(self.layers_per_block      ):
           SCREAMING_SNAKE_CASE       :      Optional[Any]							=    nn.Conv(
               UpperCAmelCase_					, kernel_size=(1, 1)					, padding="VALID"					, kernel_init=nn.initializers.zeros_init()					, bias_init=nn.initializers.zeros_init()					, dtype=self.dtype					, )
           controlnet_down_blocks.append(UpperCAmelCase_      )

         if not is_final_block:
           SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    nn.Conv(
               UpperCAmelCase_					, kernel_size=(1, 1)					, padding="VALID"					, kernel_init=nn.initializers.zeros_init()					, bias_init=nn.initializers.zeros_init()					, dtype=self.dtype					, )
           controlnet_down_blocks.append(UpperCAmelCase_      )

       SCREAMING_SNAKE_CASE       :      str							=    down_blocks
       SCREAMING_SNAKE_CASE       :      List[Any]							=    controlnet_down_blocks

       # mid
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    block_out_channels[-1]
       SCREAMING_SNAKE_CASE       :      Any							=    FlaxUNetMidBlockaDCrossAttn(
           in_channels=UpperCAmelCase_					, dropout=self.dropout					, num_attention_heads=num_attention_heads[-1]					, use_linear_projection=self.use_linear_projection					, dtype=self.dtype					, )

       SCREAMING_SNAKE_CASE       :      List[str]							=    nn.Conv(
           UpperCAmelCase_					, kernel_size=(1, 1)					, padding="VALID"					, kernel_init=nn.initializers.zeros_init()					, bias_init=nn.initializers.zeros_init()					, dtype=self.dtype					, )






     def __call__(				self       :	Tuple					, UpperCAmelCase_       :	Optional[int]					, UpperCAmelCase_       :	Tuple					, UpperCAmelCase_       :	List[Any]					, UpperCAmelCase_       :	int					, UpperCAmelCase_       :	float = 1.0					, UpperCAmelCase_       :	bool = True					, UpperCAmelCase_       :	bool = False					, ):
       SCREAMING_SNAKE_CASE       :      int							=    self.controlnet_conditioning_channel_order
       if channel_order == "bgr":
         SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    jnp.flip(UpperCAmelCase_					, axis=1      )

       # 1. time
       if not isinstance(UpperCAmelCase_					, jnp.ndarray      ):
         SCREAMING_SNAKE_CASE       :      Optional[int]							=    jnp.array([timesteps]					, dtype=jnp.intaa      )
       elif isinstance(UpperCAmelCase_					, jnp.ndarray      ) and len(timesteps.shape      ) == 0:
         SCREAMING_SNAKE_CASE       :      Any							=    timesteps.astype(dtype=jnp.floataa      )
         SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    jnp.expand_dims(UpperCAmelCase_					, 0      )

       SCREAMING_SNAKE_CASE       :      Dict							=    self.time_proj(UpperCAmelCase_      )
       SCREAMING_SNAKE_CASE       :      Dict							=    self.time_embedding(UpperCAmelCase_      )

       # 2. pre-process
       SCREAMING_SNAKE_CASE       :      Dict							=    jnp.transpose(UpperCAmelCase_					, (0, 2, 3, 1)      )
       SCREAMING_SNAKE_CASE       :      Optional[int]							=    self.conv_in(UpperCAmelCase_      )

       SCREAMING_SNAKE_CASE       :      Tuple							=    jnp.transpose(UpperCAmelCase_					, (0, 2, 3, 1)      )
       SCREAMING_SNAKE_CASE       :      Any							=    self.controlnet_cond_embedding(UpperCAmelCase_      )
       sample += controlnet_cond

       # 3. down
       SCREAMING_SNAKE_CASE       :      Optional[int]							=    (sample,)
       for down_block in self.down_blocks:
         if isinstance(UpperCAmelCase_					, UpperCAmelCase_      ):
           SCREAMING_SNAKE_CASE						,  SCREAMING_SNAKE_CASE       :      Optional[Any]							=    down_block(UpperCAmelCase_					, UpperCAmelCase_					, UpperCAmelCase_					, deterministic=not train      )
         else:
           SCREAMING_SNAKE_CASE						,  SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    down_block(UpperCAmelCase_					, UpperCAmelCase_					, deterministic=not train      )
         down_block_res_samples += res_samples

       # 4. mid
       SCREAMING_SNAKE_CASE       :      Tuple							=    self.mid_block(UpperCAmelCase_					, UpperCAmelCase_					, UpperCAmelCase_					, deterministic=not train      )

       # 5. contronet blocks
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    ()
       for down_block_res_sample, controlnet_block in zip(UpperCAmelCase_					, self.controlnet_down_blocks      ):
         SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    controlnet_block(UpperCAmelCase_      )
         controlnet_down_block_res_samples += (down_block_res_sample,)

       SCREAMING_SNAKE_CASE       :      List[Any]							=    controlnet_down_block_res_samples

       SCREAMING_SNAKE_CASE       :      List[Any]							=    self.controlnet_mid_block(UpperCAmelCase_      )

       # 6. scaling
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    [sample * conditioning_scale for sample in down_block_res_samples]
       mid_block_res_sample *= conditioning_scale

       if not return_dict:
         return (down_block_res_samples, mid_block_res_sample)

       return FlaxControlNetOutput(
           down_block_res_samples=UpperCAmelCase_					, mid_block_res_sample=UpperCAmelCase_      )














import unittest

import numpy as np

from transformers.testing_utils import is_flaky, 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 DonutImageProcessor


class  SCREAMING_SNAKE_CASE			(			unittest.TestCase					):
     '''simple docstring'''


     def __init__(				self       :	int					, UpperCAmelCase_       :	List[Any]					, UpperCAmelCase_       :	Tuple=7					, UpperCAmelCase_       :	Dict=3					, UpperCAmelCase_       :	Any=18					, UpperCAmelCase_       :	Optional[int]=30					, UpperCAmelCase_       :	Any=400					, UpperCAmelCase_       :	Optional[int]=True					, UpperCAmelCase_       :	Union[str, Any]=None					, UpperCAmelCase_       :	int=True					, UpperCAmelCase_       :	Optional[int]=False					, UpperCAmelCase_       :	List[Any]=True					, UpperCAmelCase_       :	Optional[Any]=True					, UpperCAmelCase_       :	Any=[0.5, 0.5, 0.5]					, UpperCAmelCase_       :	Dict=[0.5, 0.5, 0.5]					, ):
       SCREAMING_SNAKE_CASE       :      Any							=    parent
       SCREAMING_SNAKE_CASE       :      int							=    batch_size
       SCREAMING_SNAKE_CASE       :      Dict							=    num_channels
       SCREAMING_SNAKE_CASE       :      str							=    image_size
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    min_resolution
       SCREAMING_SNAKE_CASE       :      Any							=    max_resolution
       SCREAMING_SNAKE_CASE       :      int							=    do_resize
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    size if size is not None else {"height": 18, "width": 20}
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    do_thumbnail
       SCREAMING_SNAKE_CASE       :      Tuple							=    do_align_axis
       SCREAMING_SNAKE_CASE       :      List[str]							=    do_pad
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    do_normalize
       SCREAMING_SNAKE_CASE       :      Any							=    image_mean
       SCREAMING_SNAKE_CASE       :      Any							=    image_std






     def 				_A       (				self       :	str      ):
       return {
           "do_resize": self.do_resize,
           "size": self.size,
           "do_thumbnail": self.do_thumbnail,
           "do_align_long_axis": self.do_align_axis,
           "do_pad": self.do_pad,
           "do_normalize": self.do_normalize,
           "image_mean": self.image_mean,
           "image_std": self.image_std,
       }





@require_torch
@require_vision
class  SCREAMING_SNAKE_CASE			(			lowerCAmelCase      ,		unittest.TestCase					):
     '''simple docstring'''


     UpperCamelCase_							:		str			=	DonutImageProcessor if is_vision_available() else None


     def 				_A       (				self       :	Tuple      ):
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    DonutImageProcessingTester(self      )


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


     def 				_A       (				self       :	List[Any]      ):
       SCREAMING_SNAKE_CASE       :      Optional[Any]							=    self.image_processing_class(**self.image_processor_dict      )
       self.assertTrue(hasattr(UpperCAmelCase_					, "do_resize"      )      )
       self.assertTrue(hasattr(UpperCAmelCase_					, "size"      )      )
       self.assertTrue(hasattr(UpperCAmelCase_					, "do_thumbnail"      )      )
       self.assertTrue(hasattr(UpperCAmelCase_					, "do_align_long_axis"      )      )
       self.assertTrue(hasattr(UpperCAmelCase_					, "do_pad"      )      )
       self.assertTrue(hasattr(UpperCAmelCase_					, "do_normalize"      )      )
       self.assertTrue(hasattr(UpperCAmelCase_					, "image_mean"      )      )
       self.assertTrue(hasattr(UpperCAmelCase_					, "image_std"      )      )


     def 				_A       (				self       :	Optional[Any]      ):
       SCREAMING_SNAKE_CASE       :      Any							=    self.image_processing_class.from_dict(self.image_processor_dict      )
       self.assertEqual(image_processor.size					, {"height": 18, "width": 20}      )

       SCREAMING_SNAKE_CASE       :      List[Any]							=    self.image_processing_class.from_dict(self.image_processor_dict					, size=42      )
       self.assertEqual(image_processor.size					, {"height": 42, "width": 42}      )

       # Previous config had dimensions in (width, height) order
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    self.image_processing_class.from_dict(self.image_processor_dict					, size=(42, 84)      )
       self.assertEqual(image_processor.size					, {"height": 84, "width": 42}      )


     def 				_A       (				self       :	Dict      ):
       pass


     @is_flaky()
     def 				_A       (				self       :	Optional[Any]      ):
       # Initialize image_processing
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    self.image_processing_class(**self.image_processor_dict      )
       # create random PIL images
       SCREAMING_SNAKE_CASE       :      Tuple							=    prepare_image_inputs(self.image_processor_tester					, equal_resolution=UpperCAmelCase_      )
       for image in image_inputs:
         self.assertIsInstance(UpperCAmelCase_					, Image.Image      )

       # Test not batched input
       SCREAMING_SNAKE_CASE       :      List[str]							=    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
       SCREAMING_SNAKE_CASE       :      Dict							=    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"],
           )					, )


     @is_flaky()
     def 				_A       (				self       :	List[str]      ):
       # Initialize image_processing
       SCREAMING_SNAKE_CASE       :      Dict							=    self.image_processing_class(**self.image_processor_dict      )
       # create random numpy tensors
       SCREAMING_SNAKE_CASE       :      List[Any]							=    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
       SCREAMING_SNAKE_CASE       :      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["height"],
               self.image_processor_tester.size["width"],
           )					, )

       # Test batched
       SCREAMING_SNAKE_CASE       :      Optional[int]							=    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"],
           )					, )






     @is_flaky()
     def 				_A       (				self       :	Dict      ):
       # Initialize image_processing
       SCREAMING_SNAKE_CASE       :      List[str]							=    self.image_processing_class(**self.image_processor_dict      )
       # create random PyTorch tensors
       SCREAMING_SNAKE_CASE       :      Tuple							=    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
       SCREAMING_SNAKE_CASE       :      int							=    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
       SCREAMING_SNAKE_CASE       :      Union[str, Any]							=    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"],
           )					, )






