
"""simple docstring"""

import unittest
from timeit import timeit




def       lowercase__  (   lowerCAmelCase			:   int	,			lowerCAmelCase			:   int	)	-> int:






    """simple docstring"""




    UpperCAmelCase       =   first_num if first_num >= second_num else second_num
    UpperCAmelCase       =   max_num
    while (common_mult % first_num > 0) or (common_mult % second_num > 0):
        common_mult += max_num
    return common_mult




def       lowercase__  (   lowerCAmelCase			:   int	,			lowerCAmelCase			:   int	)	-> int:






    """simple docstring"""




    return b if a == 0 else greatest_common_divisor(b % a	,			lowerCAmelCase	)




def       lowercase__  (   lowerCAmelCase			:   int	,			lowerCAmelCase			:   int	)	-> int:






    """simple docstring"""




    return first_num // greatest_common_divisor(lowerCAmelCase	,			lowerCAmelCase	) * second_num




def       lowercase__  (   )	-> str:






    """simple docstring"""




    UpperCAmelCase       =   (
        'from __main__ import least_common_multiple_slow, least_common_multiple_fast'
    )
    print(
        'least_common_multiple_slow():'	,			timeit('least_common_multiple_slow(1000, 999)'	,			setup=lowerCAmelCase	)	,			)
    print(
        'least_common_multiple_fast():'	,			timeit('least_common_multiple_fast(1000, 999)'	,			setup=lowerCAmelCase	)	,			)
class        _UpperCAmelCase							(						unittest.TestCase							):
      __SCREAMING_SNAKE_CASE				:							int							 =		(
          (1_0, 2_0),
          (1_3, 1_5),
          (4, 3_1),
          (1_0, 4_2),
          (4_3, 3_4),
          (5, 1_2),
          (1_2, 2_5),
          (1_0, 2_5),
          (6, 9),
      )
      __SCREAMING_SNAKE_CASE				:							int							 =		(2_0, 1_9_5, 1_2_4, 2_1_0, 1_4_6_2, 6_0, 3_0_0, 5_0, 1_8)




      def       a_ (							self							)  ->   Optional[Any]:
          for i, (first_num, second_num) in enumerate(self.test_inputs							):
              UpperCAmelCase       =   least_common_multiple_slow(lowercase_				,    lowercase_							)
              UpperCAmelCase       =   least_common_multiple_fast(lowercase_				,    lowercase_							)
              with self.subTest(i=lowercase_							):
                  self.assertEqual(lowercase_				,    self.expected_results[i]							)
                  self.assertEqual(lowercase_				,    self.expected_results[i]							)


if __name__ == "__main__":
   benchmark()
   unittest.main()





"""simple docstring"""

import torch
import torch.nn as nn
from transformers.modeling_utils import ModuleUtilsMixin
from transformers.models.ta.modeling_ta import (
    TaBlock,
    TaConfig,
    TaLayerNorm,
)

from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin
class        _UpperCAmelCase							(						SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_							):




      @register_to_config
      def __init__(							self				,    lowercase_				,    lowercase_				,    lowercase_				,    lowercase_				,    lowercase_				,    lowercase_				,    lowercase_				,    lowercase_				,    lowercase_				,    lowercase_ = False				,    )  ->   List[Any]:
          super().__init__()

          UpperCAmelCase       =   nn.Linear(lowercase_				,    lowercase_				,    bias=lowercase_							)

          UpperCAmelCase       =   nn.Embedding(lowercase_				,    lowercase_							)
          UpperCAmelCase       =   False

          UpperCAmelCase       =   nn.Dropout(p=lowercase_							)

          UpperCAmelCase       =   TaConfig(
              d_model=lowercase_				,    num_heads=lowercase_				,    d_kv=lowercase_				,    d_ff=lowercase_				,    feed_forward_proj=lowercase_				,    dropout_rate=lowercase_				,    is_decoder=lowercase_				,    is_encoder_decoder=lowercase_				,    )
          UpperCAmelCase       =   nn.ModuleList()
          for lyr_num in range(lowercase_							):
              UpperCAmelCase       =   TaBlock(lowercase_							)
              self.encoders.append(lowercase_							)

          UpperCAmelCase       =   TaLayerNorm(lowercase_							)
          UpperCAmelCase       =   nn.Dropout(p=lowercase_							)




      def       a_ (							self				,    lowercase_				,    lowercase_							)  ->   Union[str, Any]:
          UpperCAmelCase       =   self.input_proj(lowercase_							)

          # terminal relative positional encodings
          UpperCAmelCase       =   encoder_inputs.shape[1]
          UpperCAmelCase       =   torch.arange(lowercase_				,    device=encoder_inputs.device							)

          UpperCAmelCase       =   encoder_inputs_mask.sum(-1							)
          UpperCAmelCase       =   torch.roll(input_positions.unsqueeze(0							)				,    tuple(seq_lens.tolist()							)				,    dims=0							)
          x += self.position_encoding(lowercase_							)

          UpperCAmelCase       =   self.dropout_pre(lowercase_							)

          # inverted the attention mask
          UpperCAmelCase       =   encoder_inputs.size()
          UpperCAmelCase       =   self.get_extended_attention_mask(lowercase_				,    lowercase_							)

          for lyr in self.encoders:
              UpperCAmelCase       =   lyr(lowercase_				,    lowercase_							)[0]
          UpperCAmelCase       =   self.layer_norm(lowercase_							)

          return self.dropout_post(lowercase_							), encoder_inputs_mask



