
from math import sqrt

def        lowerCamelCase_      (			UpperCAmelCase_							:				int       ):
						lowercase       :    Union[str, Any]											=  [1]
						for i in range(2							,			int(sqrt(UpperCAmelCase_       )       ) + 1							,			1       ):
												if number % i == 0:
																		values.append(UpperCAmelCase_       )
																		if int(number // i       ) != i:
																								values.append(int(number // i       )       )
						return sorted(UpperCAmelCase_       )

def        lowerCamelCase_      (			UpperCAmelCase_							:				int       ):
						return sum(factors(UpperCAmelCase_       )       ) > n

def        lowerCamelCase_      (			UpperCAmelCase_							:				int       ):
						lowercase       :    Dict											=  factors(UpperCAmelCase_       )
						lowercase       :    Optional[Any]											=  len(UpperCAmelCase_       )
						lowercase       :    str											=  [[0 for i in range(number + 1       )] for j in range(r + 1       )]
						for i in range(r + 1       ):
												lowercase       :    List[Any]											=  True

						for i in range(1							,			number + 1       ):
												lowercase       :    Union[str, Any]											=  False

						for i in range(1							,			r + 1       ):
												for j in range(1							,			number + 1       ):
																		if j < values[i - 1]:
																								lowercase       :    List[str]											=  subset[i - 1][j]
																		else:
																								lowercase       :    List[str]											=  subset[i - 1][j] or subset[i - 1][j - values[i - 1]]

						return subset[r][number] != 0

def        lowerCamelCase_      (			UpperCAmelCase_							:				int       ):
						return abundant(UpperCAmelCase_       ) and not semi_perfect(UpperCAmelCase_       )


if __name__ == "__main__":
				import doctest

				doctest.testmod(verbose=True)
				for number in (69, 70, 71):
								print(F'{number} is {"" if weird(number) else "not "}weird.')




from typing import List, Optional, Tuple, Union

import torch

from ...models import UNetaDModel
from ...schedulers import PNDMScheduler
from ...utils import randn_tensor
from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput







class 							UpperCAmelCase	(   __lowerCamelCase					):
					a__: UNetaDModel
					a__: PNDMScheduler

					def __init__(			self      :					List[str] ,      lowerCAmelCase      :					UNetaDModel ,      lowerCAmelCase      :					PNDMScheduler					):
											super().__init__()

											lowercase       :    int											=  PNDMScheduler.from_config(scheduler.config					)

											self.register_modules(unet=lowerCAmelCase ,      scheduler=lowerCAmelCase					)




					@torch.no_grad()
					def __call__(			self      :					List[str] ,      lowerCAmelCase      :					int = 1 ,      lowerCAmelCase      :					int = 50 ,      lowerCAmelCase      :					Optional[Union[torch.Generator, List[torch.Generator]]] = None ,      lowerCAmelCase      :					Optional[str] = "pil" ,      lowerCAmelCase      :					bool = True ,      **lowerCAmelCase      :					int ,      ):
											lowercase       :    Tuple											=  randn_tensor(
											    (batch_size, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size) ,      generator=lowerCAmelCase ,      device=self.device ,      )

											self.scheduler.set_timesteps(lowerCAmelCase					)
											for t in self.progress_bar(self.scheduler.timesteps					):
																	lowercase       :    Dict											=  self.unet(lowerCAmelCase ,      lowerCAmelCase					).sample

																	lowercase       :    Tuple											=  self.scheduler.step(lowerCAmelCase ,      lowerCAmelCase ,      lowerCAmelCase					).prev_sample

											lowercase       :    Optional[Any]											=  (image / 2 + 0.5).clamp(0 ,      1					)
											lowercase       :    Optional[int]											=  image.cpu().permute(0 ,      2 ,      3 ,      1					).numpy()
											if output_type == "pil":
																	lowercase       :    Union[str, Any]											=  self.numpy_to_pil(lowerCAmelCase					)

											if not return_dict:
																	return (image,)

											return ImagePipelineOutput(images=lowerCAmelCase					)


