






"""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        lowerCAmelCase__       (  unittest.TestCase					):
   def 	__a				(						self	:     Optional[Any]				):


        '''simple docstring'''
        UpperCAmelCase__		:  int				=				"runwayml/stable-diffusion-v1-5"
        UpperCAmelCase__		:  Optional[Any]				=				TextToVideoZeroPipeline.from_pretrained(snake_case__				,       torch_dtype=torch.floataa				).to("cuda"				)
        UpperCAmelCase__		:  Any				=				DDIMScheduler.from_config(pipe.scheduler.config				)
        UpperCAmelCase__		:  Optional[Any]				=				torch.Generator(device="cuda"				).manual_seed(0				)

        UpperCAmelCase__		:  Any				=				"A bear is playing a guitar on Times Square"
        UpperCAmelCase__		:  Dict				=				pipe(prompt=snake_case__				,       generator=snake_case__				).images

        UpperCAmelCase__		:  List[Any]				=				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(snake_case__				,       snake_case__				)





def 						UpperCamelCase_(			snake_case__:  list   )       -> list:
 UpperCAmelCase__							=				len(snake_case__   )

 # Set the gap value to be decreased by a factor of 1.3
 # after each iteration
 UpperCAmelCase__							=				1.3

 # Continue sorting until the gap is 1
 while gap > 1:
  # Decrease the gap value
  UpperCAmelCase__							=				int(gap / shrink   )

  # Sort the elements using insertion sort
  for i in range(snake_case__  ,    len(snake_case__   )   ):
   UpperCAmelCase__							=				collection[i]
   UpperCAmelCase__							=				i
   while j >= gap and collection[j - gap] > temp:
    UpperCAmelCase__							=				collection[j - gap]
    j -= gap
   UpperCAmelCase__							=				temp

 return collection


if __name__ == "__main__":
 import doctest

 doctest.testmod()



