code: 
  
  
  
  
  
  
  """simple docstring"""
  import random
  import unittest
  
  import numpy as np
  import torch
  from PIL import Image
  from torch import nn
  from transformers import (
      CLIPImageProcessor,
      CLIPTextConfig,
      CLIPTextModelWithProjection,
      CLIPTokenizer,
      CLIPVisionConfig,
      CLIPVisionModelWithProjection,
  )
  
  from diffusers import KandinskyVaaPriorEmbaEmbPipeline, PriorTransformer, UnCLIPScheduler
  from diffusers.utils import floats_tensor, torch_device
  from diffusers.utils.testing_utils import enable_full_determinism, skip_mps
  
  from ..test_pipelines_common import PipelineTesterMixin
  
  
  enable_full_determinism()
  
  
  
  class 					UpperCamelCase__   (							a_       ,  unittest.TestCase):
  
  
  
  
  
  
  
      """simple docstring"""
      __UpperCAmelCase											=   KandinskyVaaPriorEmbaEmbPipeline
      __UpperCAmelCase											=   ["""prompt""", """image"""]
      __UpperCAmelCase											=   ["""prompt""", """image"""]
      __UpperCAmelCase											=   [
          """num_images_per_prompt""",
          """strength""",
          """generator""",
          """num_inference_steps""",
          """latents""",
          """negative_prompt""",
          """guidance_scale""",
          """output_type""",
          """return_dict""",
      ]
      __UpperCAmelCase											=   False
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  Tuple   ):
  
  
  
  
  
             '''simple docstring'''
  
             return 3_2
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  Tuple   ):
  
  
  
  
  
             '''simple docstring'''
  
             return 3_2
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  List[Any]   ):
  
  
  
  
  
             '''simple docstring'''
  
             return self.time_input_dim
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  List[Any]   ):
  
  
  
  
  
             '''simple docstring'''
  
             return self.time_input_dim * 4
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  List[str]   ):
  
  
  
  
  
             '''simple docstring'''
  
             return 1_0_0
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  List[Any]   ):
  
  
  
  
  
             '''simple docstring'''
  
             __magic_name__										=						CLIPTokenizer.from_pretrained('hf-internal-testing/tiny-random-clip'   )
             return tokenizer
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  Dict   ):
  
  
  
  
  
             '''simple docstring'''
  
             torch.manual_seed(0   )
             __magic_name__										=						CLIPTextConfig(
                 bos_token_id=0							,						eos_token_id=2							,						hidden_size=self.text_embedder_hidden_size							,						projection_dim=self.text_embedder_hidden_size							,						intermediate_size=3_7							,						layer_norm_eps=1e-0_5							,						num_attention_heads=4							,						num_hidden_layers=5							,						pad_token_id=1							,						vocab_size=1_0_0_0							,						)
             return CLIPTextModelWithProjection(UpperCamelCase_   )
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  Optional[int]   ):
  
  
  
  
  
             '''simple docstring'''
  
             torch.manual_seed(0   )
  
             __magic_name__										=						{
                 'num_attention_heads': 2,
                 'attention_head_dim': 1_2,
                 'embedding_dim': self.text_embedder_hidden_size,
                 'num_layers': 1,
             }
  
             __magic_name__										=						PriorTransformer(**UpperCamelCase_   )
             # clip_std and clip_mean is initialized to be 0 so PriorTransformer.post_process_latents will always return 0 - set clip_std to be 1 so it won't return 0
             __magic_name__										=						nn.Parameter(torch.ones(model.clip_std.shape   )   )
             return model
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  Dict   ):
  
  
  
  
  
             '''simple docstring'''
  
             torch.manual_seed(0   )
             __magic_name__										=						CLIPVisionConfig(
                 hidden_size=self.text_embedder_hidden_size							,						image_size=2_2_4							,						projection_dim=self.text_embedder_hidden_size							,						intermediate_size=3_7							,						num_attention_heads=4							,						num_channels=3							,						num_hidden_layers=5							,						patch_size=1_4							,						)
  
             __magic_name__										=						CLIPVisionModelWithProjection(UpperCamelCase_   )
             return model
  
  
  
  
  
  
  
      @property
      def 							a__ (		self   :  Any   ):
  
  
  
  
  
             '''simple docstring'''
  
             __magic_name__										=						CLIPImageProcessor(
                 crop_size=2_2_4							,						do_center_crop=UpperCamelCase_							,						do_normalize=UpperCamelCase_							,						do_resize=UpperCamelCase_							,						image_mean=[0.48_145_466, 0.4_578_275, 0.40_821_073]							,						image_std=[0.26_862_954, 0.26_130_258, 0.27_577_711]							,						resample=3							,						size=2_2_4							,						)
  
             return image_processor
  
  
  
  
  
  
  
      def 							a__ (		self   :  Any   ):
  
  
  
  
  
             '''simple docstring'''
  
             __magic_name__										=						self.dummy_prior
             __magic_name__										=						self.dummy_image_encoder
             __magic_name__										=						self.dummy_text_encoder
             __magic_name__										=						self.dummy_tokenizer
             __magic_name__										=						self.dummy_image_processor
  
             __magic_name__										=						UnCLIPScheduler(
                 variance_type='fixed_small_log'							,						prediction_type='sample'							,						num_train_timesteps=1_0_0_0							,						clip_sample=UpperCamelCase_							,						clip_sample_range=10.0							,						)
  
             __magic_name__										=						{
                 'prior': prior,
                 'image_encoder': image_encoder,
                 'text_encoder': text_encoder,
                 'tokenizer': tokenizer,
                 'scheduler': scheduler,
                 'image_processor': image_processor,
             }
  
             return components
  
  
  
  
  
  
  
      def 							a__ (		self   :  Any							,						UpperCamelCase_   :  Tuple							,						UpperCamelCase_   :  Tuple=0   ):
  
  
  
  
  
             '''simple docstring'''
  
             if str(UpperCamelCase_   ).startswith('mps'   ):
                    __magic_name__										=						torch.manual_seed(UpperCamelCase_   )
             else:
                    __magic_name__										=						torch.Generator(device=UpperCamelCase_   ).manual_seed(UpperCamelCase_   )
  
             __magic_name__										=						floats_tensor((1, 3, 6_4, 6_4)							,						rng=random.Random(UpperCamelCase_   )   ).to(UpperCamelCase_   )
             __magic_name__										=						image.cpu().permute(0							,						2							,						3							,						1   )[0]
             __magic_name__										=						Image.fromarray(np.uinta(UpperCamelCase_   )   ).convert('RGB'   ).resize((2_5_6, 2_5_6)   )
  
             __magic_name__										=						{
                 'prompt': 'horse',
                 'image': init_image,
                 'strength': 0.5,
                 'generator': generator,
                 'guidance_scale': 4.0,
                 'num_inference_steps': 2,
                 'output_type': 'np',
             }
             return inputs
  
  
  
  
  
  
  
      def 							a__ (		self   :  Optional[int]   ):
  
  
  
  
  
             '''simple docstring'''
  
             __magic_name__										=						'cpu'
  
             __magic_name__										=						self.get_dummy_components()
  
             __magic_name__										=						self.pipeline_class(**UpperCamelCase_   )
             __magic_name__										=						pipe.to(UpperCamelCase_   )
  
             pipe.set_progress_bar_config(disable=UpperCamelCase_   )
  
             __magic_name__										=						pipe(**self.get_dummy_inputs(UpperCamelCase_   )   )
             __magic_name__										=						output.image_embeds
  
             __magic_name__										=						pipe(
                 **self.get_dummy_inputs(UpperCamelCase_   )							,						return_dict=UpperCamelCase_							,						)[0]
  
             __magic_name__										=						image[0, -1_0:]
             __magic_name__										=						image_from_tuple[0, -1_0:]
  
             assert image.shape == (1, 3_2)
  
             __magic_name__										=						np.array(
                 [
                     0.1_071_284,
                     1.3_330_271,
                     0.61_260_223,
                     -0.6_691_065,
                     -0.3_846_852,
                     -1.0_303_661,
                     0.22_716_111,
                     0.03_348_901,
                     0.30_040_675,
                     -0.24_805_029,
                 ]   )
  
             assert np.abs(image_slice.flatten() - expected_slice   ).max() < 1e-2
             assert np.abs(image_from_tuple_slice.flatten() - expected_slice   ).max() < 1e-2
  
  
  
  
  
  
  
      @skip_mps
      def 							a__ (		self   :  Any   ):
  
  
  
  
  
             '''simple docstring'''
  
             __magic_name__										=						torch_device == 'cpu'
             __magic_name__										=						True
             __magic_name__										=						False
  
             self._test_inference_batch_single_identical(
                 test_max_difference=UpperCamelCase_							,						relax_max_difference=UpperCamelCase_							,						test_mean_pixel_difference=UpperCamelCase_							,						)
  
  
  
  
  
  
  
      @skip_mps
      def 							a__ (		self   :  Dict   ):
  
  
  
  
  
             '''simple docstring'''
  
             __magic_name__										=						torch_device == 'cpu'
             __magic_name__										=						False
  
             self._test_attention_slicing_forward_pass(
                 test_max_difference=UpperCamelCase_							,						test_mean_pixel_difference=UpperCamelCase_							,						)
style_context: 
  
  
  
  
  
  
  """simple docstring"""
  def        A	(							__snake_case:   Dict   ,    __snake_case:   Tuple     )						->		int:
  
         """simple docstring"""
  
  
  
  
  
         sequence.append(__snake_case     )
  
         __magic_name__										=						0
         while sequence[index] != target:
                index += 1
  
         sequence.pop()
  
         if index == len(__snake_case     ):
                return None
  
         return index
  
  
  if __name__ == "__main__":
   snake_case   :   Dict    		=		input("""Enter numbers separated by comma:\n""").strip()
   snake_case   :   List[str]    		=		[int(item) for item in user_input.split(""",""")]
  
   snake_case   :   Union[str, Any]    		=		input("""Enter a single number to be found in the list:\n""")
   snake_case   :   str    		=		int(target_input)
   snake_case   :   Any    		=		sentinel_linear_search(sequence, target)
   if result is not None:
    print(f"""{target} found at positions: {result}""")
   else:
    print("""Not found""")