




import torch

from transformers import PreTrainedModel

from .custom_configuration import CustomConfig, NoSuperInitConfig
class      _UpperCamelCase (			lowerCAmelCase						):
      UpperCAmelCase_            =						CustomConfig
      def __init__(     self				:Any	, lowerCamelCase				:int )       ->     List[Any]:
       super().__init__(lowerCamelCase )
       UpperCAmelCase__								=  torch.nn.Linear(config.hidden_size	, config.hidden_size )
      def 		UpperCAmelCase_  (     self				:Any	, lowerCamelCase				:Any )       ->     int:
       return self.linear(lowerCamelCase )







      def 		UpperCAmelCase_  (     self				:Optional[int]	, lowerCamelCase				:Optional[Any] )       ->     Optional[int]:
       pass



class      _UpperCamelCase (			lowerCAmelCase						):
      UpperCAmelCase_            =						NoSuperInitConfig
      def __init__(     self				:Tuple	, lowerCamelCase				:Any )       ->     Dict:
       super().__init__(lowerCamelCase )
       UpperCAmelCase__								=  torch.nn.Linear(config.attribute	, config.attribute )
      def 		UpperCAmelCase_  (     self				:List[Any]	, lowerCamelCase				:List[str] )       ->     Any:
       return self.linear(lowerCamelCase )







      def 		UpperCAmelCase_  (     self				:Union[str, Any]	, lowerCamelCase				:Optional[Any] )       ->     str:
       pass











from __future__ import annotations



def   lowerCAmelCase						(						_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int		):




 """simple docstring"""







 assert (
     c % greatest_common_divisor(_lowerCAmelCase  ,							_lowerCAmelCase		) == 0
 )  # greatest_common_divisor(a,b) function implemented below
 ((UpperCAmelCase__)	,	(UpperCAmelCase__)	,	(UpperCAmelCase__))								=  extended_gcd(_lowerCAmelCase  ,							_lowerCAmelCase		)  # extended_gcd(a,b) function implemented below
 UpperCAmelCase__								=  c / d
 return (r * x, r * y)



def   lowerCAmelCase						(						_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int = 2		):




 """simple docstring"""







 ((UpperCAmelCase__)	,	(UpperCAmelCase__))								=  diophantine(_lowerCAmelCase  ,							_lowerCAmelCase  ,							_lowerCAmelCase		)  # Initial value
 UpperCAmelCase__								=  greatest_common_divisor(_lowerCAmelCase  ,							_lowerCAmelCase		)
 UpperCAmelCase__								=  a // d
 UpperCAmelCase__								=  b // d

 for i in range(_lowerCAmelCase		):
  UpperCAmelCase__								=  xa + i * q
  UpperCAmelCase__								=  ya - i * p
  print(_lowerCAmelCase  ,							_lowerCAmelCase		)



def   lowerCAmelCase						(						_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int		):




 """simple docstring"""







 if a < b:
  UpperCAmelCase__	,	UpperCAmelCase__								=  b, a

 while a % b != 0:
  UpperCAmelCase__	,	UpperCAmelCase__								=  b, a % b

 return b



def   lowerCAmelCase						(						_lowerCAmelCase							:				int  ,							_lowerCAmelCase							:				int		):




 """simple docstring"""







 assert a >= 0 and b >= 0

 if b == 0:
  UpperCAmelCase__	,	UpperCAmelCase__	,	UpperCAmelCase__								=  a, 1, 0
 else:
  ((UpperCAmelCase__)	,	(UpperCAmelCase__)	,	(UpperCAmelCase__))								=  extended_gcd(_lowerCAmelCase  ,							a % b		)
  UpperCAmelCase__								=  q
  UpperCAmelCase__								=  p - q * (a // b)

 assert a % d == 0 and b % d == 0
 assert d == a * x + b * y

 return (d, x, y)


if __name__ == "__main__":
  from doctest import testmod

  testmod(name="diophantine", verbose=True)
  testmod(name="diophantine_all_soln", verbose=True)
  testmod(name="extended_gcd", verbose=True)
  testmod(name="greatest_common_divisor", verbose=True)





