
'''simple docstring'''





a__						:				int           =    1_0_0_0





def     snake_case							(						UpperCAmelCase		)->     float:







      """simple docstring"""
      return x * x





def     snake_case							(						UpperCAmelCase ,					UpperCAmelCase ,					UpperCAmelCase ,					UpperCAmelCase = 4		)->     float:







      """simple docstring"""
      assert callable(
          UpperCAmelCase		), f'the function(object) passed should be callable your input : {function}'
      assert isinstance(UpperCAmelCase ,					(float, int)		), f'a should be float or integer your input : {a}'
      assert isinstance(function(UpperCAmelCase		) ,					(float, int)		), (
          "the function should return integer or float return type of your function, "
          f'{type(UpperCAmelCase		)}'
      )
      assert isinstance(UpperCAmelCase ,					(float, int)		), f'b should be float or integer your input : {b}'
      assert (
          isinstance(UpperCAmelCase ,					UpperCAmelCase		) and precision > 0
      ), f'precision should be positive integer your input : {precision}'

      # just applying the formula of simpson for approximate integration written in
      # mentioned article in first comment of this file and above this function

      __A    		=     (b - a) / N_STEPS
      __A    		=     function(UpperCAmelCase		) + function(UpperCAmelCase		)

      for i in range(1 ,					UpperCAmelCase		):
            __A    		=     a + h * i
            result += function(UpperCAmelCase		) * (4 if i % 2 else 2)

      result *= h / 3
      return round(UpperCAmelCase ,					UpperCAmelCase		)


if __name__ == "__main__":
 import doctest

 doctest.testmod()








'''simple docstring'''





import unittest

import torch

from diffusers import DDIMScheduler, TextToVideoZeroPipeline
from diffusers.utils import load_pt, require_torch_gpu, slow

from ..test_pipelines_common import assert_mean_pixel_difference


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






 def 		lowercase_  (     self					:Optional[int]     )			->     List[Any]:







       '''simple docstring'''



       __A    		=     'runwayml/stable-diffusion-v1-5'
       __A    		=     TextToVideoZeroPipeline.from_pretrained(_A		,			torch_dtype=torch.floataa     ).to('cuda'     )
       __A    		=     DDIMScheduler.from_config(pipe.scheduler.config     )
       __A    		=     torch.Generator(device='cuda'     ).manual_seed(0     )

       __A    		=     'A bear is playing a guitar on Times Square'
       __A    		=     pipe(prompt=_A		,			generator=_A     ).images

       __A    		=     load_pt(
           'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/A bear is playing a guitar on Times Square.pt'     )

       assert_mean_pixel_difference(_A		,			_A     )






