code: 
  from typing import List
  
  import PIL
  import torch
  from PIL import Image
  
  from ...configuration_utils import ConfigMixin
  from ...models.modeling_utils import ModelMixin
  from ...utils import PIL_INTERPOLATION
  
  
  
  
  class      __lowercase	(	__snake_case      ,   __snake_case					):
  
  
  
  
  
  
  	def __init__(self							:   Optional[int]						)   -> List[str]:
  							super().__init__()
  
  							self.register_buffer("watermark_image"			,  torch.zeros((62, 62, 4)						)						)
  							_lowercase					:  Optional[Any]    			=      None
  
  
  
  
  
  
  	def 			_a(self							:   int			,  snake_case							:   List[PIL.Image.Image]			,  snake_case							:   int=None						)   -> Union[str, Any]:
  							# copied from https://github.com/deep-floyd/IF/blob/b77482e36ca2031cb94dbca1001fc1e6400bf4ab/deepfloyd_if/modules/base.py#L287
  
  							_lowercase					:  str    			=      images[0].height
  							_lowercase					:  List[str]    			=      images[0].width
  
  							_lowercase					:  Optional[Any]    			=      sample_size or h
  
  							_lowercase					:  List[Any]    			=      min(h / sample_size			,  w / sample_size						)
  							_lowercase			,						_lowercase					:  str    			=      (int(h / coef						), int(w / coef						)) if coef < 1 else (h, w)
  
  							_lowercase			,						_lowercase					:  List[str]    			=      1024**2, img_w * img_h
  							_lowercase					:  int    			=      (Sa / Sa) ** 0.5
  							_lowercase			,						_lowercase			,						_lowercase					:  List[str]    			=      int(K * 62						), img_w - int(14 * K						), img_h - int(14 * K						)
  
  							if self.watermark_image_as_pil is None:
  													_lowercase					:  List[str]    			=      self.watermark_image.to(torch.uinta						).cpu().numpy()
  													_lowercase					:  Union[str, Any]    			=      Image.fromarray(snake_case			,  mode="RGBA"						)
  													_lowercase					:  int    			=      watermark_image
  
  							_lowercase					:  Dict    			=      self.watermark_image_as_pil.resize(
  							    (wm_size, wm_size)			,  PIL_INTERPOLATION["bicubic"]			,  reducing_gap=snake_case						)
  
  							for pil_img in images:
  													pil_img.paste(snake_case			,  box=(wm_x - wm_size, wm_y - wm_size, wm_x, wm_y)			,  mask=wm_img.split()[-1]						)
  
  							return images
  
  
  
  
  
style_context: 
  import math
  
  
  
  def 		UpperCamelCase    (					_UpperCAmelCase     :      int     )      -> list:
  
  
  
  
  
  
  						'''simple docstring'''
  
  						if n <= 0:
  												raise ValueError("Only positive integers have prime factors"     )
  						_lowercase					:  Optional[int]    			=      []
  						while n % 2 == 0:
  												pf.append(2     )
  												_lowercase					:  Tuple    			=      int(n / 2     )
  						for i in range(3   , int(math.sqrt(_UpperCAmelCase     )     ) + 1   , 2     ):
  												while n % i == 0:
  																		pf.append(_UpperCAmelCase     )
  																		_lowercase					:  Optional[int]    			=      int(n / i     )
  						if n > 2:
  												pf.append(_UpperCAmelCase     )
  						return pf
  
  
  
  def 		UpperCamelCase    (					_UpperCAmelCase     :      int     )      -> int:
  
  
  
  
  
  
  						'''simple docstring'''
  
  						if n <= 0:
  												raise ValueError("Only positive numbers are accepted"     )
  						_lowercase					:  str    			=      1
  						_lowercase					:  Tuple    			=      1
  						while n % 2 == 0:
  												temp += 1
  												_lowercase					:  List[Any]    			=      int(n / 2     )
  						div *= temp
  						for i in range(3   , int(math.sqrt(_UpperCAmelCase     )     ) + 1   , 2     ):
  												_lowercase					:  Optional[Any]    			=      1
  												while n % i == 0:
  																		temp += 1
  																		_lowercase					:  Optional[Any]    			=      int(n / i     )
  												div *= temp
  						if n > 1:
  												div *= 2
  						return div
  
  
  
  def 		UpperCamelCase    (					_UpperCAmelCase     :      int     )      -> int:
  
  
  
  
  
  
  						'''simple docstring'''
  
  						if n <= 0:
  												raise ValueError("Only positive numbers are accepted"     )
  						_lowercase					:  int    			=      1
  						_lowercase					:  List[str]    			=      1
  						while n % 2 == 0:
  												temp += 1
  												_lowercase					:  str    			=      int(n / 2     )
  						if temp > 1:
  												s *= (2**temp - 1) / (2 - 1)
  						for i in range(3   , int(math.sqrt(_UpperCAmelCase     )     ) + 1   , 2     ):
  												_lowercase					:  int    			=      1
  												while n % i == 0:
  																		temp += 1
  																		_lowercase					:  List[Any]    			=      int(n / i     )
  												if temp > 1:
  																		s *= (i**temp - 1) / (i - 1)
  						return int(_UpperCAmelCase     )
  
  
  
  def 		UpperCamelCase    (					_UpperCAmelCase     :      int     )      -> int:
  
  
  
  
  
  
  						'''simple docstring'''
  
  						_lowercase					:  int    			=      n
  						for x in set(prime_factors(_UpperCAmelCase     )     ):
  												s *= (x - 1) / x
  						return int(_UpperCAmelCase     )
  
  
  if __name__ == "__main__":
  							import doctest
  
  							doctest.testmod()
  
  
  
  
  