

'''simple docstring'''



import unittest

import numpy as np
import torch

from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel
from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device


enable_full_determinism()







class 		lowerCAmelCase__  ( unittest.TestCase   ):



 """simple docstring"""



 @property
 def  UpperCAmelCase__						(						self   :			List[str]     )    ->					List[str]:


      """simple docstring"""




      torch.manual_seed(0     )
      __SCREAMING_SNAKE_CASE      = 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   :			Tuple     )    ->					Optional[int]:


      """simple docstring"""




      __SCREAMING_SNAKE_CASE      = self.dummy_uncond_unet
      __SCREAMING_SNAKE_CASE      = ScoreSdeVeScheduler()

      __SCREAMING_SNAKE_CASE      = ScoreSdeVePipeline(unet=lowercase_   ,				scheduler=lowercase_     )
      sde_ve.to(lowercase_     )
      sde_ve.set_progress_bar_config(disable=lowercase_     )

      __SCREAMING_SNAKE_CASE      = torch.manual_seed(0     )
      __SCREAMING_SNAKE_CASE      = sde_ve(num_inference_steps=2   ,				output_type="""numpy"""   ,				generator=lowercase_     ).images

      __SCREAMING_SNAKE_CASE      = torch.manual_seed(0     )
      __SCREAMING_SNAKE_CASE      = sde_ve(num_inference_steps=2   ,				output_type="""numpy"""   ,				generator=lowercase_   ,				return_dict=lowercase_     )[
          0
      ]

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

      assert image.shape == (1, 32, 32, 3)
      __SCREAMING_SNAKE_CASE      = 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 		lowerCAmelCase__  ( unittest.TestCase   ):



 """simple docstring"""



 def  UpperCAmelCase__						(						self   :			Dict     )    ->					str:


      """simple docstring"""




      __SCREAMING_SNAKE_CASE      = """google/ncsnpp-church-256"""
      __SCREAMING_SNAKE_CASE      = UNetaDModel.from_pretrained(lowercase_     )

      __SCREAMING_SNAKE_CASE      = ScoreSdeVeScheduler.from_pretrained(lowercase_     )

      __SCREAMING_SNAKE_CASE      = ScoreSdeVePipeline(unet=lowercase_   ,				scheduler=lowercase_     )
      sde_ve.to(lowercase_     )
      sde_ve.set_progress_bar_config(disable=lowercase_     )

      __SCREAMING_SNAKE_CASE      = torch.manual_seed(0     )
      __SCREAMING_SNAKE_CASE      = sde_ve(num_inference_steps=10   ,				output_type="""numpy"""   ,				generator=lowercase_     ).images

      __SCREAMING_SNAKE_CASE      = image[0, -3:, -3:, -1]

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

      __SCREAMING_SNAKE_CASE      = np.array([0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0]     )

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








"""simple docstring"""

import math




def      lowercase__    (       lowerCAmelCase					:       str			,					lowerCAmelCase					:       Optional[Any]			)			->   List[Any]:






    """simple docstring"""




    if 0 not in (x, y):
        # We use the relation x^y = y*log10(x), where 10 is the base.
        return y * math.logaa(lowerCAmelCase			)
    else:
        if x == 0:  # 0 raised to any number is 0
            return 0
        elif y == 0:
            return 1  # any number raised to 0 is 1
    raise AssertionError('This should never happen'			)


if __name__ == "__main__":  # Main function
   # Read two numbers from input and typecast them to int using map function.
   # Here x is the base and y is the power.
   SCREAMING_SNAKE_CASE_            =    '''Enter the base and the power separated by a comma: '''
   SCREAMING_SNAKE_CASE_       ,    SCREAMING_SNAKE_CASE_            =    map(int, input(prompt).split(''','''))
   SCREAMING_SNAKE_CASE_       ,    SCREAMING_SNAKE_CASE_            =    map(int, input(prompt).split(''','''))

   # We find the log of each number, using the function res(), which takes two
   # arguments.
   SCREAMING_SNAKE_CASE_            =    res(xa, ya)
   SCREAMING_SNAKE_CASE_            =    res(xa, ya)

   # We check for the largest number
   if resa > resa:
      print('''Largest number is''', xa, '''^''', ya)
   elif resa > resa:
      print('''Largest number is''', xa, '''^''', ya)
   else:
      print('''Both are equal''')



