code: 
  
  
  
  import unittest
  
  import numpy as np
  import PIL
  import torch
  
  from diffusers.image_processor import VaeImageProcessor
  
  
  
  
  
  
  class 	lowercase		(				unittest.TestCase):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	@property
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Tuple  )    ->				List[Any]:
  							UpperCAmelCase_=     1
  							UpperCAmelCase_=     3
  							UpperCAmelCase_=     8
  							UpperCAmelCase_=     8
  
  							UpperCAmelCase_=     torch.rand((batch_size, num_channels, height, width)  )
  
  							return sample
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Optional[int]		,						__UpperCAmelCase			:		List[Any]  )    ->				Dict:
  							if isinstance(image[0]		,						PIL.Image.Image  ):
  													return np.stack([np.array(__UpperCAmelCase  ) for i in image]		,						axis=0  )
  							elif isinstance(__UpperCAmelCase		,						torch.Tensor  ):
  													return image.cpu().numpy().transpose(0		,						2		,						3		,						1  )
  							return image
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		List[str]  )    ->				List[Any]:
  							UpperCAmelCase_=     VaeImageProcessor(do_resize=__UpperCAmelCase		,						do_normalize=__UpperCAmelCase  )
  
  							UpperCAmelCase_=     self.dummy_sample
  							UpperCAmelCase_=     self.to_np(__UpperCAmelCase  )
  
  							for output_type in ["pt", "np", "pil"]:
  													UpperCAmelCase_=     image_processor.postprocess(
  													    image_processor.preprocess(__UpperCAmelCase  )		,						output_type=__UpperCAmelCase		,						)
  													UpperCAmelCase_=     self.to_np(__UpperCAmelCase  )
  													UpperCAmelCase_=     (input_np * 255).round() if output_type == """pil""" else input_np
  													assert (
  													    np.abs(in_np - out_np  ).max() < 1E-6
  													), F"""decoded output does not match input for output_type {output_type}"""
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Any  )    ->				Any:
  							UpperCAmelCase_=     VaeImageProcessor(do_resize=__UpperCAmelCase		,						do_normalize=__UpperCAmelCase  )
  							UpperCAmelCase_=     self.dummy_sample.cpu().numpy().transpose(0		,						2		,						3		,						1  )
  
  							for output_type in ["pt", "np", "pil"]:
  													UpperCAmelCase_=     image_processor.postprocess(image_processor.preprocess(__UpperCAmelCase  )		,						output_type=__UpperCAmelCase  )
  
  													UpperCAmelCase_=     self.to_np(__UpperCAmelCase  )
  													UpperCAmelCase_=     (input_np * 255).round() if output_type == """pil""" else input_np
  													assert (
  													    np.abs(in_np - out_np  ).max() < 1E-6
  													), F"""decoded output does not match input for output_type {output_type}"""
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Any  )    ->				Optional[Any]:
  							UpperCAmelCase_=     VaeImageProcessor(do_resize=__UpperCAmelCase		,						do_normalize=__UpperCAmelCase  )
  
  							UpperCAmelCase_=     self.dummy_sample.cpu().numpy().transpose(0		,						2		,						3		,						1  )
  							UpperCAmelCase_=     image_processor.numpy_to_pil(__UpperCAmelCase  )
  
  							for output_type in ["pt", "np", "pil"]:
  													UpperCAmelCase_=     image_processor.postprocess(image_processor.preprocess(__UpperCAmelCase  )		,						output_type=__UpperCAmelCase  )
  													for i, o in zip(__UpperCAmelCase		,						__UpperCAmelCase  ):
  																			UpperCAmelCase_=     np.array(__UpperCAmelCase  )
  																			UpperCAmelCase_=     self.to_np(__UpperCAmelCase  ) if output_type == """pil""" else (self.to_np(__UpperCAmelCase  ) * 255).round()
  																			assert (
  																			    np.abs(in_np - out_np  ).max() < 1E-6
  																			), F"""decoded output does not match input for output_type {output_type}"""
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Optional[Any]  )    ->				List[str]:
  							UpperCAmelCase_=     VaeImageProcessor(do_resize=__UpperCAmelCase		,						do_normalize=__UpperCAmelCase  )
  
  							UpperCAmelCase_=     self.dummy_sample
  							UpperCAmelCase_=     input_pt_ad.squeeze(0  )
  
  							UpperCAmelCase_=     image_processor.postprocess(
  							    image_processor.preprocess(__UpperCAmelCase  )		,						output_type="""np"""		,						)
  							UpperCAmelCase_=     image_processor.postprocess(
  							    image_processor.preprocess(__UpperCAmelCase  )		,						output_type="""np"""		,						)
  
  							UpperCAmelCase_=     self.to_np(self.dummy_sample  )
  							UpperCAmelCase_=     input_np_ad.squeeze(0  )
  
  							UpperCAmelCase_=     image_processor.postprocess(
  							    image_processor.preprocess(__UpperCAmelCase  )		,						output_type="""np"""		,						)
  							UpperCAmelCase_=     image_processor.postprocess(
  							    image_processor.preprocess(__UpperCAmelCase  )		,						output_type="""np"""		,						)
  
  							assert np.abs(out_pt_ad - out_pt_ad  ).max() < 1E-6
  							assert np.abs(out_np_ad - out_np_ad  ).max() < 1E-6
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Optional[int]  )    ->				Union[str, Any]:
  							UpperCAmelCase_=     VaeImageProcessor(do_resize=__UpperCAmelCase		,						do_normalize=__UpperCAmelCase  )
  
  							UpperCAmelCase_=     self.dummy_sample
  							UpperCAmelCase_=     list(__UpperCAmelCase  )
  
  							UpperCAmelCase_=     image_processor.postprocess(
  							    image_processor.preprocess(__UpperCAmelCase  )		,						output_type="""np"""		,						)
  
  							UpperCAmelCase_=     image_processor.postprocess(
  							    image_processor.preprocess(__UpperCAmelCase  )		,						output_type="""np"""		,						)
  
  							UpperCAmelCase_=     self.to_np(self.dummy_sample  )
  							list(__UpperCAmelCase  )
  
  							UpperCAmelCase_=     image_processor.postprocess(
  							    image_processor.preprocess(__UpperCAmelCase  )		,						output_type="""np"""		,						)
  
  							UpperCAmelCase_=     image_processor.postprocess(
  							    image_processor.preprocess(__UpperCAmelCase  )		,						output_type="""np"""		,						)
  
  							assert np.abs(out_pt_ad - out_pt_list  ).max() < 1E-6
  							assert np.abs(out_np_ad - out_np_list  ).max() < 1E-6
  
  
  
  
  
style_context: 
  
  
  
  from __future__ import annotations
  
  
  
  def  __a  (					lowerCAmelCase_     :      int       )   ->				int | None:
  
  
  
  
  
  
  						'''simple docstring'''
  
  
  
  						for r in range(1    ,lowerCAmelCase_       ):
  												UpperCAmelCase_=     []
  												for x in range(n - 1       ):
  																		UpperCAmelCase_=     pow(lowerCAmelCase_    ,lowerCAmelCase_    ,lowerCAmelCase_       )
  																		if val in li:
  																								break
  																		li.append(lowerCAmelCase_       )
  												else:
  																		return r
  						return None
  
  
  if __name__ == "__main__":
  	__A       					=		int(input('''Enter a prime number q: '''))
  	__A       					=		find_primitive(q)
  	if a is None:
  		print(f'Cannot find the primitive for the value: {a!r}')
  	else:
  		__A       					=		int(input('''Enter private key of A: '''))
  		__A       					=		pow(a, a_private, q)
  		__A       					=		int(input('''Enter private key of B: '''))
  		__A       					=		pow(a, b_private, q)
  
  		__A       					=		pow(b_public, a_private, q)
  		__A       					=		pow(a_public, b_private, q)
  
  		print('''The key value generated by A is: ''', a_secret)
  		print('''The key value generated by B is: ''', b_secret)
  
  
  
  
  