






'''simple docstring'''

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__											=     False






class        a_		(    unittest.TestCase       ):
  pass






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

  def 						A__		(   self   )						->   str:



        """simple docstring"""






        UpperCamelCase       						=      VersatileDiffusionImageVariationPipeline.from_pretrained("""shi-labs/versatile-diffusion"""   )
        pipe.to(_a   )
        pipe.set_progress_bar_config(disable=_a   )

        UpperCamelCase       						=      load_image(
            """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg"""   )
        UpperCamelCase       						=      torch.manual_seed(0   )
        UpperCamelCase       						=      pipe(
            image=_a    ,	generator=_a    ,	guidance_scale=7.5    ,	num_inference_steps=50    ,	output_type="""numpy"""    ,	).images

        UpperCamelCase       						=      image[0, 253:256, 253:256, -1]

        assert image.shape == (1, 512, 512, 3)
        UpperCamelCase       						=      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







'''simple docstring'''

SCREAMING_SNAKE_CASE__											=     8.31_44_62  # Unit - J mol-1 K-1







def 					lowercase__				(   __UpperCamelCase	,		__UpperCamelCase	,		__UpperCamelCase					)->				float:
      if moles < 0 or kelvin < 0 or volume < 0:
            raise ValueError("""Invalid inputs. Enter positive value."""					)
      return moles * kelvin * UNIVERSAL_GAS_CONSTANT / volume







def 					lowercase__				(   __UpperCamelCase	,		__UpperCamelCase	,		__UpperCamelCase					)->				float:
      if moles < 0 or kelvin < 0 or pressure < 0:
            raise ValueError("""Invalid inputs. Enter positive value."""					)
      return moles * kelvin * UNIVERSAL_GAS_CONSTANT / pressure


if __name__ == "__main__":
     from doctest import testmod

     testmod()
