
"""simple docstring"""



from __future__ import annotations

import math






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					int						):






							"""simple docstring"""



							if 1 < number < 4:
														# 2 and 3 are primes
														return True
							elif number < 2 or number % 2 == 0 or number % 3 == 0:
														# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
														return False

							# All primes number are in format of 6k +/- 1
							for i in range(5     ,  int(math.sqrt(SCREAMING_SNAKE_CASE						) + 1						)     ,  6						):
														if number % i == 0 or number % (i + 2) == 0:
																					return False
							return True


_snake_case          =						[num for num in range(3, 1_0_0_0_0_1, 2) if not is_prime(num)]






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					int						):






							"""simple docstring"""



							if not isinstance(SCREAMING_SNAKE_CASE     ,  SCREAMING_SNAKE_CASE						):
														raise ValueError('n must be an integer'						)
							if n <= 0:
														raise ValueError('n must be >= 0'						)

							_lowerCAmelCase  	=			[]
							for num in range(len(SCREAMING_SNAKE_CASE						)						):
														_lowerCAmelCase  	=			0
														while 2 * i * i <= odd_composites[num]:
																					_lowerCAmelCase  	=			odd_composites[num] - 2 * i * i
																					if is_prime(SCREAMING_SNAKE_CASE						):
																												break
																					i += 1
														else:
																					list_nums.append(odd_composites[num]						)
																					if len(SCREAMING_SNAKE_CASE						) == n:
																												return list_nums

							return []






def 	__snake_case  (    ):






							"""simple docstring"""



							return compute_nums(1						)[0]


if __name__ == "__main__":
	print(f'{solution() = }')








"""simple docstring"""



import argparse

import intel_extension_for_pytorch as ipex
import torch

from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline


_snake_case          =						argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add_help=False)
parser.add_argument('''--dpm''', action='''store_true''', help='''Enable DPMSolver or not''')
parser.add_argument('''--steps''', default=None, type=int, help='''Num inference steps''')
_snake_case          =						parser.parse_args()


_snake_case          =						'''cpu'''
_snake_case          =						'''a lovely <dicoo> in red dress and hat, in the snowly and brightly night, with many brighly buildings'''

_snake_case          =						'''path-to-your-trained-model'''
_snake_case          =						StableDiffusionPipeline.from_pretrained(model_id)
if args.dpm:
	_snake_case          =						DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
_snake_case          =						pipe.to(device)

# to channels last
_snake_case          =						pipe.unet.to(memory_format=torch.channels_last)
_snake_case          =						pipe.vae.to(memory_format=torch.channels_last)
_snake_case          =						pipe.text_encoder.to(memory_format=torch.channels_last)
if pipe.requires_safety_checker:
	_snake_case          =						pipe.safety_checker.to(memory_format=torch.channels_last)

# optimize with ipex
_snake_case          =						torch.randn(2, 4, 6_4, 6_4)
_snake_case          =						torch.rand(1) * 9_9_9
_snake_case          =						torch.randn(2, 7_7, 7_6_8)
_snake_case          =						(sample, timestep, encoder_hidden_status)
try:
	_snake_case          =						ipex.optimize(pipe.unet.eval(), dtype=torch.bfloataa, inplace=True, sample_input=input_example)
except Exception:
	_snake_case          =						ipex.optimize(pipe.unet.eval(), dtype=torch.bfloataa, inplace=True)
_snake_case          =						ipex.optimize(pipe.vae.eval(), dtype=torch.bfloataa, inplace=True)
_snake_case          =						ipex.optimize(pipe.text_encoder.eval(), dtype=torch.bfloataa, inplace=True)
if pipe.requires_safety_checker:
	_snake_case          =						ipex.optimize(pipe.safety_checker.eval(), dtype=torch.bfloataa, inplace=True)

# compute
_snake_case          =						6_6_6
_snake_case          =						torch.Generator(device).manual_seed(seed)
_snake_case          =						{'''generator''': generator}
if args.steps is not None:
	_snake_case          =						args.steps

with torch.cpu.amp.autocast(enabled=True, dtype=torch.bfloataa):
	_snake_case          =						pipe(prompt, **generate_kwargs).images[0]

# save image
image.save('''generated.png''')






