






'''simple docstring'''






import gc
import random
import tempfile
import unittest

import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer

from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel
from diffusers.pipelines.semantic_stable_diffusion import SemanticStableDiffusionPipeline as StableDiffusionPipeline
from diffusers.utils import floats_tensor, nightly, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu


enable_full_determinism()




class a_     (     unittest.TestCase				):







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






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







   @property
   def      SCREAMING_SNAKE_CASE__       (self)      ->   Tuple:
      """simple docstring"""






      __snake_case					:   Any  				=			1
      __snake_case					:   Optional[int]  				=			3
      __snake_case					:   int  				=			(3_2, 3_2)

      __snake_case					:   int  				=			floats_tensor((batch_size, num_channels) + sizes       , rng=random.Random(0)).to(lowerCamelCase__)
      return image







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






      torch.manual_seed(0)
      __snake_case					:   int  				=			UNetaDConditionModel(
          block_out_channels=(3_2, 6_4)       , layers_per_block=2       , sample_size=3_2       , in_channels=4       , out_channels=4       , down_block_types=('DownBlock2D', 'CrossAttnDownBlock2D')       , up_block_types=('CrossAttnUpBlock2D', 'UpBlock2D')       , cross_attention_dim=3_2       , )
      return model







   @property
   def      SCREAMING_SNAKE_CASE__       (self)      ->   Any:
      """simple docstring"""






      torch.manual_seed(0)
      __snake_case					:   Any  				=			AutoencoderKL(
          block_out_channels=[3_2, 6_4]       , in_channels=3       , out_channels=3       , down_block_types=['DownEncoderBlock2D', 'DownEncoderBlock2D']       , up_block_types=['UpDecoderBlock2D', 'UpDecoderBlock2D']       , latent_channels=4       , )
      return model







   @property
   def      SCREAMING_SNAKE_CASE__       (self)      ->   Union[str, Any]:
      """simple docstring"""






      torch.manual_seed(0)
      __snake_case					:   List[Any]  				=			CLIPTextConfig(
          bos_token_id=0       , eos_token_id=2       , hidden_size=3_2       , intermediate_size=3_7       , layer_norm_eps=1E-05       , num_attention_heads=4       , num_hidden_layers=5       , pad_token_id=1       , vocab_size=1_0_0_0       , )
      return CLIPTextModel(lowerCamelCase__)







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






      def extract(*__a       , **__a):




         class a_     :







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






               __snake_case					:   Dict  				=			torch.ones([0])







            def      SCREAMING_SNAKE_CASE__       (self       , __a)      ->   Any:
               """simple docstring"""






               self.pixel_values.to(lowerCamelCase__)
               return self


         return Out()

      return extract







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






      __snake_case					:   str  				=			"cpu"  # ensure determinism for the device-dependent torch.Generator
      __snake_case					:   List[str]  				=			self.dummy_cond_unet
      __snake_case					:   int  				=			DDIMScheduler(
          beta_start=0.00_085       , beta_end=0.012       , beta_schedule='scaled_linear'       , clip_sample=lowerCamelCase__       , set_alpha_to_one=lowerCamelCase__       , )

      __snake_case					:   Tuple  				=			self.dummy_vae
      __snake_case					:   Any  				=			self.dummy_text_encoder
      __snake_case					:   Optional[Any]  				=			CLIPTokenizer.from_pretrained('hf-internal-testing/tiny-random-clip')

      # make sure here that pndm scheduler skips prk
      __snake_case					:   List[Any]  				=			StableDiffusionPipeline(
          unet=lowerCamelCase__       , scheduler=lowerCamelCase__       , vae=lowerCamelCase__       , text_encoder=lowerCamelCase__       , tokenizer=lowerCamelCase__       , safety_checker=lowerCamelCase__       , feature_extractor=self.dummy_extractor       , )
      __snake_case					:   Union[str, Any]  				=			sd_pipe.to(lowerCamelCase__)
      sd_pipe.set_progress_bar_config(disable=lowerCamelCase__)

      __snake_case					:   str  				=			"A painting of a squirrel eating a burger"

      __snake_case					:   Optional[int]  				=			torch.Generator(device=lowerCamelCase__).manual_seed(0)
      __snake_case					:   Any  				=			sd_pipe([prompt]       , generator=lowerCamelCase__       , guidance_scale=6.0       , num_inference_steps=2       , output_type='np')
      __snake_case					:   Any  				=			output.images

      __snake_case					:   int  				=			torch.Generator(device=lowerCamelCase__).manual_seed(0)
      __snake_case					:   Any  				=			sd_pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=6.0       , num_inference_steps=2       , output_type='np'       , return_dict=lowerCamelCase__       , )[0]

      __snake_case					:   Any  				=			image[0, -3:, -3:, -1]
      __snake_case					:   Tuple  				=			image_from_tuple[0, -3:, -3:, -1]

      assert image.shape == (1, 6_4, 6_4, 3)
      __snake_case					:   Dict  				=			np.array([0.5_753, 0.6_114, 0.5_001, 0.5_034, 0.5_470, 0.4_729, 0.4_971, 0.4_867, 0.4_867])

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2
      assert np.abs(image_from_tuple_slice.flatten() - expected_slice).max() < 1E-2







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






      __snake_case					:   int  				=			"cpu"  # ensure determinism for the device-dependent torch.Generator
      __snake_case					:   Dict  				=			self.dummy_cond_unet
      __snake_case					:   Any  				=			PNDMScheduler(skip_prk_steps=lowerCamelCase__)
      __snake_case					:   List[Any]  				=			self.dummy_vae
      __snake_case					:   str  				=			self.dummy_text_encoder
      __snake_case					:   Optional[Any]  				=			CLIPTokenizer.from_pretrained('hf-internal-testing/tiny-random-clip')

      # make sure here that pndm scheduler skips prk
      __snake_case					:   int  				=			StableDiffusionPipeline(
          unet=lowerCamelCase__       , scheduler=lowerCamelCase__       , vae=lowerCamelCase__       , text_encoder=lowerCamelCase__       , tokenizer=lowerCamelCase__       , safety_checker=lowerCamelCase__       , feature_extractor=self.dummy_extractor       , )
      __snake_case					:   Dict  				=			sd_pipe.to(lowerCamelCase__)
      sd_pipe.set_progress_bar_config(disable=lowerCamelCase__)

      __snake_case					:   Union[str, Any]  				=			"A painting of a squirrel eating a burger"
      __snake_case					:   List[str]  				=			torch.Generator(device=lowerCamelCase__).manual_seed(0)
      __snake_case					:   Dict  				=			sd_pipe([prompt]       , generator=lowerCamelCase__       , guidance_scale=6.0       , num_inference_steps=2       , output_type='np')

      __snake_case					:   Union[str, Any]  				=			output.images

      __snake_case					:   Union[str, Any]  				=			torch.Generator(device=lowerCamelCase__).manual_seed(0)
      __snake_case					:   Any  				=			sd_pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=6.0       , num_inference_steps=2       , output_type='np'       , return_dict=lowerCamelCase__       , )[0]

      __snake_case					:   List[str]  				=			image[0, -3:, -3:, -1]
      __snake_case					:   Tuple  				=			image_from_tuple[0, -3:, -3:, -1]

      assert image.shape == (1, 6_4, 6_4, 3)
      __snake_case					:   Any  				=			np.array([0.5_122, 0.5_712, 0.4_825, 0.5_053, 0.5_646, 0.4_769, 0.5_179, 0.4_894, 0.4_994])

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2
      assert np.abs(image_from_tuple_slice.flatten() - expected_slice).max() < 1E-2







   def      SCREAMING_SNAKE_CASE__       (self)      ->   Any:
      """simple docstring"""






      __snake_case					:   List[str]  				=			StableDiffusionPipeline.from_pretrained(
          'hf-internal-testing/tiny-stable-diffusion-lms-pipe'       , safety_checker=lowerCamelCase__)
      assert isinstance(lowerCamelCase__       , lowerCamelCase__)
      assert isinstance(pipe.scheduler       , lowerCamelCase__)
      assert pipe.safety_checker is None

      __snake_case					:   Optional[int]  				=			pipe('example prompt'       , num_inference_steps=2).images[0]
      assert image is not None

      # check that there's no error when saving a pipeline with one of the models being None
      with tempfile.TemporaryDirectory() as tmpdirname:
         pipe.save_pretrained(lowerCamelCase__)
         __snake_case					:   Dict  				=			StableDiffusionPipeline.from_pretrained(lowerCamelCase__)

      # sanity check that the pipeline still works
      assert pipe.safety_checker is None
      __snake_case					:   List[Any]  				=			pipe('example prompt'       , num_inference_steps=2).images[0]
      assert image is not None







   @unittest.skipIf(torch_device != 'cuda'       , 'This test requires a GPU')
   def      SCREAMING_SNAKE_CASE__       (self)      ->   Tuple:
      """simple docstring"""






      __snake_case					:   int  				=			self.dummy_cond_unet
      __snake_case					:   Optional[int]  				=			PNDMScheduler(skip_prk_steps=lowerCamelCase__)
      __snake_case					:   str  				=			self.dummy_vae
      __snake_case					:   Optional[Any]  				=			self.dummy_text_encoder
      __snake_case					:   List[Any]  				=			CLIPTokenizer.from_pretrained('hf-internal-testing/tiny-random-clip')

      # put models in fp16
      __snake_case					:   Union[str, Any]  				=			unet.half()
      __snake_case					:   str  				=			vae.half()
      __snake_case					:   List[str]  				=			bert.half()

      # make sure here that pndm scheduler skips prk
      __snake_case					:   Tuple  				=			StableDiffusionPipeline(
          unet=lowerCamelCase__       , scheduler=lowerCamelCase__       , vae=lowerCamelCase__       , text_encoder=lowerCamelCase__       , tokenizer=lowerCamelCase__       , safety_checker=lowerCamelCase__       , feature_extractor=self.dummy_extractor       , )
      __snake_case					:   Tuple  				=			sd_pipe.to(lowerCamelCase__)
      sd_pipe.set_progress_bar_config(disable=lowerCamelCase__)

      __snake_case					:   List[Any]  				=			"A painting of a squirrel eating a burger"
      __snake_case					:   int  				=			sd_pipe([prompt]       , num_inference_steps=2       , output_type='np').images

      assert image.shape == (1, 6_4, 6_4, 3)




@nightly
@require_torch_gpu
class a_     (     unittest.TestCase				):







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






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







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






      __snake_case					:   Optional[int]  				=			"cuda"
      __snake_case					:   List[Any]  				=			StableDiffusionPipeline.from_pretrained('runwayml/stable-diffusion-v1-5')
      __snake_case					:   Dict  				=			pipe.to(lowerCamelCase__)
      pipe.set_progress_bar_config(disable=lowerCamelCase__)

      __snake_case					:   Optional[int]  				=			"a photo of a cat"
      __snake_case					:   List[Any]  				=			{
          "editing_prompt": ["sunglasses"],
          "reverse_editing_direction": [False],
          "edit_warmup_steps": 1_0,
          "edit_guidance_scale": 6,
          "edit_threshold": 0.95,
          "edit_momentum_scale": 0.5,
          "edit_mom_beta": 0.6,
      }

      __snake_case					:   Union[str, Any]  				=			3
      __snake_case					:   Optional[int]  				=			7

      # no sega enabled
      __snake_case					:   str  				=			torch.Generator(lowerCamelCase__)
      generator.manual_seed(lowerCamelCase__)
      __snake_case					:   List[Any]  				=			pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=lowerCamelCase__       , num_inference_steps=5_0       , output_type='np'       , width=5_1_2       , height=5_1_2       , )

      __snake_case					:   Optional[int]  				=			output.images
      __snake_case					:   Dict  				=			image[0, -3:, -3:, -1]
      __snake_case					:   Optional[Any]  				=			[
          0.34_673_113,
          0.38_492_733,
          0.37_597_352,
          0.34_086_335,
          0.35_650_748,
          0.35_579_205,
          0.3_384_763,
          0.34_340_236,
          0.3_573_271,
      ]

      assert image.shape == (1, 5_1_2, 5_1_2, 3)

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2

      # with sega enabled
      # generator = torch.manual_seed(seed)
      generator.manual_seed(lowerCamelCase__)
      __snake_case					:   int  				=			pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=lowerCamelCase__       , num_inference_steps=5_0       , output_type='np'       , width=5_1_2       , height=5_1_2       , **lowerCamelCase__       , )

      __snake_case					:   Dict  				=			output.images
      __snake_case					:   Union[str, Any]  				=			image[0, -3:, -3:, -1]
      __snake_case					:   Optional[int]  				=			[
          0.41_887_826,
          0.37_728_766,
          0.30_138_272,
          0.41_416_335,
          0.41_664_985,
          0.36_283_392,
          0.36_191_246,
          0.43_364_465,
          0.43_001_732,
      ]

      assert image.shape == (1, 5_1_2, 5_1_2, 3)

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2







   def      SCREAMING_SNAKE_CASE__       (self)      ->   Any:
      """simple docstring"""






      __snake_case					:   Tuple  				=			"cuda"
      __snake_case					:   Any  				=			StableDiffusionPipeline.from_pretrained('runwayml/stable-diffusion-v1-5')
      __snake_case					:   List[Any]  				=			pipe.to(lowerCamelCase__)
      pipe.set_progress_bar_config(disable=lowerCamelCase__)

      __snake_case					:   Tuple  				=			"an image of a crowded boulevard, realistic, 4k"
      __snake_case					:   int  				=			{
          "editing_prompt": "crowd, crowded, people",
          "reverse_editing_direction": True,
          "edit_warmup_steps": 1_0,
          "edit_guidance_scale": 8.3,
          "edit_threshold": 0.9,
          "edit_momentum_scale": 0.5,
          "edit_mom_beta": 0.6,
      }

      __snake_case					:   List[Any]  				=			9
      __snake_case					:   Tuple  				=			7

      # no sega enabled
      __snake_case					:   Tuple  				=			torch.Generator(lowerCamelCase__)
      generator.manual_seed(lowerCamelCase__)
      __snake_case					:   str  				=			pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=lowerCamelCase__       , num_inference_steps=5_0       , output_type='np'       , width=5_1_2       , height=5_1_2       , )

      __snake_case					:   List[str]  				=			output.images
      __snake_case					:   Union[str, Any]  				=			image[0, -3:, -3:, -1]
      __snake_case					:   str  				=			[
          0.43_497_998,
          0.91_814_065,
          0.7_540_739,
          0.55_580_205,
          0.8_467_265,
          0.5_389_691,
          0.62_574_506,
          0.58_897_763,
          0.50_926_757,
      ]

      assert image.shape == (1, 5_1_2, 5_1_2, 3)

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2

      # with sega enabled
      # generator = torch.manual_seed(seed)
      generator.manual_seed(lowerCamelCase__)
      __snake_case					:   List[str]  				=			pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=lowerCamelCase__       , num_inference_steps=5_0       , output_type='np'       , width=5_1_2       , height=5_1_2       , **lowerCamelCase__       , )

      __snake_case					:   Union[str, Any]  				=			output.images
      __snake_case					:   Dict  				=			image[0, -3:, -3:, -1]
      __snake_case					:   Dict  				=			[
          0.3_089_719,
          0.30_500_144,
          0.29_016_042,
          0.30_630_964,
          0.325_687,
          0.29_419_225,
          0.2_908_091,
          0.28_723_598,
          0.27_696_294,
      ]

      assert image.shape == (1, 5_1_2, 5_1_2, 3)

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2







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






      __snake_case					:   Union[str, Any]  				=			"cuda"
      __snake_case					:   str  				=			StableDiffusionPipeline.from_pretrained('runwayml/stable-diffusion-v1-5')
      __snake_case					:   Dict  				=			pipe.to(lowerCamelCase__)
      pipe.set_progress_bar_config(disable=lowerCamelCase__)

      __snake_case					:   str  				=			"a castle next to a river"
      __snake_case					:   Optional[int]  				=			{
          "editing_prompt": ["boat on a river, boat", "monet, impression, sunrise"],
          "reverse_editing_direction": False,
          "edit_warmup_steps": [1_5, 1_8],
          "edit_guidance_scale": 6,
          "edit_threshold": [0.9, 0.8],
          "edit_momentum_scale": 0.5,
          "edit_mom_beta": 0.6,
      }

      __snake_case					:   Tuple  				=			4_8
      __snake_case					:   List[Any]  				=			7

      # no sega enabled
      __snake_case					:   List[Any]  				=			torch.Generator(lowerCamelCase__)
      generator.manual_seed(lowerCamelCase__)
      __snake_case					:   List[str]  				=			pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=lowerCamelCase__       , num_inference_steps=5_0       , output_type='np'       , width=5_1_2       , height=5_1_2       , )

      __snake_case					:   List[str]  				=			output.images
      __snake_case					:   Tuple  				=			image[0, -3:, -3:, -1]
      __snake_case					:   str  				=			[
          0.75_163_555,
          0.76_037_145,
          0.61_785,
          0.9_189_673,
          0.8_627_701,
          0.85_189_694,
          0.8_512_813,
          0.87_012_076,
          0.8_312_857,
      ]

      assert image.shape == (1, 5_1_2, 5_1_2, 3)

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2

      # with sega enabled
      # generator = torch.manual_seed(seed)
      generator.manual_seed(lowerCamelCase__)
      __snake_case					:   List[Any]  				=			pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=lowerCamelCase__       , num_inference_steps=5_0       , output_type='np'       , width=5_1_2       , height=5_1_2       , **lowerCamelCase__       , )

      __snake_case					:   Tuple  				=			output.images
      __snake_case					:   Optional[Any]  				=			image[0, -3:, -3:, -1]
      __snake_case					:   int  				=			[
          0.73_553_365,
          0.7_537_271,
          0.74_341_905,
          0.66_480_356,
          0.6_472_925,
          0.63_039_416,
          0.64_812_905,
          0.6_749_717,
          0.6_517_102,
      ]

      assert image.shape == (1, 5_1_2, 5_1_2, 3)

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2







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






      __snake_case					:   Tuple  				=			"cuda"
      __snake_case					:   Tuple  				=			StableDiffusionPipeline.from_pretrained('runwayml/stable-diffusion-v1-5'       , torch_dtype=torch.floataa)
      __snake_case					:   int  				=			pipe.to(lowerCamelCase__)
      pipe.set_progress_bar_config(disable=lowerCamelCase__)

      __snake_case					:   Optional[Any]  				=			"a photo of a cat"
      __snake_case					:   Any  				=			{
          "editing_prompt": ["sunglasses"],
          "reverse_editing_direction": [False],
          "edit_warmup_steps": 1_0,
          "edit_guidance_scale": 6,
          "edit_threshold": 0.95,
          "edit_momentum_scale": 0.5,
          "edit_mom_beta": 0.6,
      }

      __snake_case					:   int  				=			3
      __snake_case					:   str  				=			7

      # no sega enabled
      __snake_case					:   Dict  				=			torch.Generator(lowerCamelCase__)
      generator.manual_seed(lowerCamelCase__)
      __snake_case					:   Optional[int]  				=			pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=lowerCamelCase__       , num_inference_steps=5_0       , output_type='np'       , width=5_1_2       , height=5_1_2       , )

      __snake_case					:   List[str]  				=			output.images
      __snake_case					:   str  				=			image[0, -3:, -3:, -1]
      __snake_case					:   Dict  				=			[
          0.34_887_695,
          0.3_876_953,
          0.375,
          0.34_423_828,
          0.3_581_543,
          0.35_717_773,
          0.3_383_789,
          0.34_570_312,
          0.359_375,
      ]

      assert image.shape == (1, 5_1_2, 5_1_2, 3)

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2

      # with sega enabled
      # generator = torch.manual_seed(seed)
      generator.manual_seed(lowerCamelCase__)
      __snake_case					:   Union[str, Any]  				=			pipe(
          [prompt]       , generator=lowerCamelCase__       , guidance_scale=lowerCamelCase__       , num_inference_steps=5_0       , output_type='np'       , width=5_1_2       , height=5_1_2       , **lowerCamelCase__       , )

      __snake_case					:   Any  				=			output.images
      __snake_case					:   Any  				=			image[0, -3:, -3:, -1]
      __snake_case					:   Union[str, Any]  				=			[
          0.42_285_156,
          0.36_914_062,
          0.29_077_148,
          0.42_041_016,
          0.41_918_945,
          0.35_498_047,
          0.3_618_164,
          0.4_423_828,
          0.43_115_234,
      ]

      assert image.shape == (1, 5_1_2, 5_1_2, 3)

      assert np.abs(image_slice.flatten() - expected_slice).max() < 1E-2



'''simple docstring'''


from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowerCamelCase__     						=  logging.get_logger(__name__)

lowerCamelCase__     						=  {
    'facebook/convnext-tiny-224': 'https://huggingface.co/facebook/convnext-tiny-224/resolve/main/config.json',
    # See all ConvNeXT models at https://huggingface.co/models?filter=convnext
}






class 						lowerCAmelCase__      (      UpperCAmelCase__     ,							UpperCAmelCase__						):
			lowerCAmelCase			:						Optional[Any]							 =  "convnext"




			def __init__(		self	:  Optional[int]						,	lowerCamelCase__	:  List[str]=3						,	lowerCamelCase__	:  List[str]=4						,	lowerCamelCase__	:  Optional[int]=4						,	lowerCamelCase__	:  Dict=None						,	lowerCamelCase__	:  Tuple=None						,	lowerCamelCase__	:  List[str]="gelu"						,	lowerCamelCase__	:  List[Any]=0.0_2						,	lowerCamelCase__	:  Dict=1E-12						,	lowerCamelCase__	:  Tuple=1E-6						,	lowerCamelCase__	:  Dict=0.0						,	lowerCamelCase__	:  Optional[int]=2_24						,	lowerCamelCase__	:  List[Any]=None						,	lowerCamelCase__	:  Any=None						,	**lowerCamelCase__	:  int						,	) ->str:



					'''simple docstring'''







					super().__init__(**lowerCamelCase__			)

					_UpperCAmelCase		:							Optional[int]             =   num_channels
					_UpperCAmelCase		:							Tuple             =   patch_size
					_UpperCAmelCase		:							Dict             =   num_stages
					_UpperCAmelCase		:							Optional[int]             =   [96, 1_92, 3_84, 7_68] if hidden_sizes is None else hidden_sizes
					_UpperCAmelCase		:							Dict             =   [3, 3, 9, 3] if depths is None else depths
					_UpperCAmelCase		:							Union[str, Any]             =   hidden_act
					_UpperCAmelCase		:							Tuple             =   initializer_range
					_UpperCAmelCase		:							Tuple             =   layer_norm_eps
					_UpperCAmelCase		:							Tuple             =   layer_scale_init_value
					_UpperCAmelCase		:							str             =   drop_path_rate
					_UpperCAmelCase		:							str             =   image_size
					_UpperCAmelCase		:							Tuple             =   ["stem"] + [F"""stage{idx}""" for idx in range(1						,	len(self.depths			) + 1			)]
					_UpperCAmelCase       ,     _UpperCAmelCase		:							str             =   get_aligned_output_features_output_indices(
					    out_features=lowerCamelCase__						,	out_indices=lowerCamelCase__						,	stage_names=self.stage_names			)






class 						lowerCAmelCase__      (      UpperCAmelCase__						):
			lowerCAmelCase			:						str							 =  version.parse("1.11"						)




			@property
			def 				lowerCAmelCase__     (		self	:  Dict			) ->Mapping[str, Mapping[int, str]]:



					'''simple docstring'''







					return OrderedDict(
					    [
					        ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
					    ]			)






			@property
			def 				lowerCAmelCase__     (		self	:  str			) ->float:



					'''simple docstring'''







					return 1E-5



