





"""simple docstring"""
import unittest

import numpy as np
import torch

from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel
from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device


enable_full_determinism()






class  _SCREAMING_SNAKE_CASE(       unittest.TestCase  ):




       @property
       def    _UpperCamelCase					(						self							)      ->				Dict:





             """simple docstring"""






             torch.manual_seed(0							)
             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  UNetaDModel(
                 block_out_channels=(32, 64)		,layers_per_block=2		,sample_size=32		,in_channels=3		,out_channels=3		,down_block_types=('''DownBlock2D''', '''AttnDownBlock2D''')		,up_block_types=('''AttnUpBlock2D''', '''UpBlock2D''')		,)
             return model




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





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Tuple		    =  self.dummy_uncond_unet
             __SCREAMING_SNAKE_CASE       :List[str]		    =  KarrasVeScheduler()

             __SCREAMING_SNAKE_CASE       :Dict		    =  KarrasVePipeline(unet=SCREAMING_SNAKE_CASE__		,scheduler=SCREAMING_SNAKE_CASE__							)
             pipe.to(SCREAMING_SNAKE_CASE__							)
             pipe.set_progress_bar_config(disable=SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE       :Tuple		    =  torch.manual_seed(0							)
             __SCREAMING_SNAKE_CASE       :str		    =  pipe(num_inference_steps=2		,generator=SCREAMING_SNAKE_CASE__		,output_type='''numpy'''							).images

             __SCREAMING_SNAKE_CASE       :List[str]		    =  torch.manual_seed(0							)
             __SCREAMING_SNAKE_CASE       :Tuple		    =  pipe(num_inference_steps=2		,generator=SCREAMING_SNAKE_CASE__		,output_type='''numpy'''		,return_dict=SCREAMING_SNAKE_CASE__							)[0]

             __SCREAMING_SNAKE_CASE       :str		    =  image[0, -3:, -3:, -1]
             __SCREAMING_SNAKE_CASE       :Dict		    =  image_from_tuple[0, -3:, -3:, -1]

             assert image.shape == (1, 32, 32, 3)
             __SCREAMING_SNAKE_CASE       :Any		    =  np.array([0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0]							)

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






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




       def    _UpperCamelCase					(						self							)      ->				List[str]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :str		    =  '''google/ncsnpp-celebahq-256'''
             __SCREAMING_SNAKE_CASE       :str		    =  UNetaDModel.from_pretrained(SCREAMING_SNAKE_CASE__							)
             __SCREAMING_SNAKE_CASE       :List[str]		    =  KarrasVeScheduler()

             __SCREAMING_SNAKE_CASE       :Tuple		    =  KarrasVePipeline(unet=SCREAMING_SNAKE_CASE__		,scheduler=SCREAMING_SNAKE_CASE__							)
             pipe.to(SCREAMING_SNAKE_CASE__							)
             pipe.set_progress_bar_config(disable=SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE       :List[str]		    =  torch.manual_seed(0							)
             __SCREAMING_SNAKE_CASE       :List[Any]		    =  pipe(num_inference_steps=20		,generator=SCREAMING_SNAKE_CASE__		,output_type='''numpy'''							).images

             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  image[0, -3:, -3:, -1]
             assert image.shape == (1, 2_56, 2_56, 3)
             __SCREAMING_SNAKE_CASE       :Optional[int]		    =  np.array([0.5_7_8, 0.5_8_1_1, 0.5_9_2_4, 0.5_8_0_9, 0.5_8_7, 0.5_8_8_6, 0.5_8_6_1, 0.5_8_0_2, 0.5_8_6]							)

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






"""simple docstring"""
def 					__lowerCamelCase       (							a_					:		str			,       a_					:		str							)      ->				str:
      __SCREAMING_SNAKE_CASE       :int		    =  len(a_							)
      __SCREAMING_SNAKE_CASE       :int		    =  len(a_							)
      __SCREAMING_SNAKE_CASE       :int		    =  (
          first_str_length if first_str_length > second_str_length else second_str_length
      )
      __SCREAMING_SNAKE_CASE       :list		    =  []
      for char_count in range(a_							):
            if char_count < first_str_length:
                  output_list.append(first_str[char_count]							)
            if char_count < second_str_length:
                  output_list.append(second_str[char_count]							)
      return "".join(a_							)


if __name__ == "__main__":
  print(alternative_string_arrange("AB", "XYZ"), end=" ")