


import unittest

import numpy as np
import torch

from diffusers import VersatileDiffusionImageVariationPipeline
from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device


SCREAMING_SNAKE_CASE__					:     Tuple       =     False


class 		_SCREAMING_SNAKE_CASE     (						unittest.TestCase     ):
     pass


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


     def        __snake_case(  self    ):
       _UpperCAmelCase		:							Any							=     VersatileDiffusionImageVariationPipeline.from_pretrained("""shi-labs/versatile-diffusion"""    )
       pipe.to(A_    )
       pipe.set_progress_bar_config(disable=A_    )

       _UpperCAmelCase		:							Optional[Any]							=     load_image(
           """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg"""    )
       _UpperCAmelCase		:							Dict							=     torch.manual_seed(0    )
       _UpperCAmelCase		:							Optional[int]							=     pipe(
           image=A_							,					generator=A_							,					guidance_scale=7.5							,					num_inference_steps=50							,					output_type="""numpy"""							,					).images

       _UpperCAmelCase		:							Union[str, Any]							=     image[0, 2_53:2_56, 2_53:2_56, -1]

       assert image.shape == (1, 5_12, 5_12, 3)
       _UpperCAmelCase		:							Optional[Any]							=     np.array([0.0_4_4_1, 0.0_4_6_9, 0.0_5_0_7, 0.0_5_7_5, 0.0_6_3_2, 0.0_6_5_0, 0.0_8_6_5, 0.0_9_0_9, 0.0_9_4_5]    )

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









def    a__    (		snake_case__					:							int						,   snake_case__					:							int     ):
  return 1 if input_a == input_a else 0




def    a__    (		):
  assert xnor_gate(0						,   0     ) == 1
  assert xnor_gate(0						,   1     ) == 0
  assert xnor_gate(1						,   0     ) == 0
  assert xnor_gate(1						,   1     ) == 1


if __name__ == "__main__":
 print(xnor_gate(0, 0))
 print(xnor_gate(0, 1))
 print(xnor_gate(1, 0))
 print(xnor_gate(1, 1))





