





from string import ascii_uppercase

_UpperCAmelCase       : Optional[Any]			     =       {str(ord(c) - 55): c for c in ascii_uppercase}


def  SCREAMING_SNAKE_CASE   ( _UpperCAmelCase		,			_UpperCAmelCase				)    ->  List[Any]:
    if isinstance(lowerCAmelCase__		,			lowerCAmelCase__				):
        raise TypeError('int() can\'t convert non-string with explicit base'				)
    if num < 0:
        raise ValueError('parameter must be positive int'				)
    if isinstance(lowerCAmelCase__		,			lowerCAmelCase__				):
        raise TypeError('\'str\' object cannot be interpreted as an integer'				)
    if isinstance(lowerCAmelCase__		,			lowerCAmelCase__				):
        raise TypeError('\'float\' object cannot be interpreted as an integer'				)
    if base in (0, 1):
        raise ValueError('base must be >= 2'				)
    if base > 36:
        raise ValueError('base must be <= 36'				)
    lowerCamelCase__					:   Any      				=	''
    lowerCamelCase__					:   Union[str, Any]      				=	0
    lowerCamelCase__					:   str      				=	0
    while div != 1:
        lowerCamelCase__				,							lowerCamelCase__					:   str      				=	divmod(lowerCAmelCase__		,			lowerCAmelCase__				)
        if base >= 11 and 9 < mod < 36:
            lowerCamelCase__					:   Dict      				=	ALPHABET_VALUES[str(lowerCAmelCase__				)]
        else:
            lowerCamelCase__					:   Tuple      				=	str(lowerCAmelCase__				)
        new_value += actual_value
        lowerCamelCase__					:   List[str]      				=	num // base
        lowerCamelCase__					:   int      				=	div
        if div == 0:
            return str(new_value[::-1]				)
        elif div == 1:
            new_value += str(lowerCAmelCase__				)
            return str(new_value[::-1]				)

    return new_value[::-1]


if __name__ == "__main__":
    import doctest

    doctest.testmod()

    for base in range(2, 37):
        for num in range(10_00):
            assert int(decimal_to_any(num, base), base) == num, (
                num,
                base,
                decimal_to_any(num, base),
                int(decimal_to_any(num, base), base),
            )












import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_torch


if is_torch_available():
    import torch

    from transformers.activations import gelu_new, gelu_python, get_activation

@require_torch
class      lowerCAmelCase							(      unittest.TestCase    ):
 def   A_			(   self						:   Tuple			)    ->			int:
     lowerCamelCase__					:   Optional[int]      				=	torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]			)
     lowerCamelCase__					:   Dict      				=	get_activation('gelu'			)
     self.assertTrue(torch.allclose(gelu_python(UpperCAmelCase			)    ,  torch_builtin(UpperCAmelCase			)			)			)
     self.assertFalse(torch.allclose(gelu_python(UpperCAmelCase			)    ,  gelu_new(UpperCAmelCase			)			)			)
 def   A_			(   self						:   Dict			)    ->			str:
     lowerCamelCase__					:   Optional[int]      				=	torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]			)
     lowerCamelCase__					:   str      				=	get_activation('gelu'			)
     lowerCamelCase__					:   Tuple      				=	get_activation('gelu_10'			)

     lowerCamelCase__					:   Tuple      				=	torch_builtin(UpperCAmelCase			)
     lowerCamelCase__					:   List[str]      				=	geluaa(UpperCAmelCase			)

     lowerCamelCase__					:   Tuple      				=	torch.where(y_gelu_aa < 1_0.0    ,  1    ,  0			)

     self.assertTrue(torch.max(UpperCAmelCase			).item() == 1_0.0			)
     self.assertTrue(torch.allclose(y_gelu * clipped_mask    ,  y_gelu_aa * clipped_mask			)			)
 def   A_			(   self						:   str			)    ->			List[str]:
     get_activation('gelu'			)
     get_activation('gelu_10'			)
     get_activation('gelu_fast'			)
     get_activation('gelu_new'			)
     get_activation('gelu_python'			)
     get_activation('gelu_pytorch_tanh'			)
     get_activation('linear'			)
     get_activation('mish'			)
     get_activation('quick_gelu'			)
     get_activation('relu'			)
     get_activation('sigmoid'			)
     get_activation('silu'			)
     get_activation('swish'			)
     get_activation('tanh'			)
     with self.assertRaises(UpperCAmelCase			):
         get_activation('bogus'			)
     with self.assertRaises(UpperCAmelCase			):
         get_activation(UpperCAmelCase			)







 def   A_			(   self						:   Any			)    ->			Optional[Any]:
     lowerCamelCase__					:   Optional[Any]      				=	get_activation('gelu'			)
     lowerCamelCase__					:   Union[str, Any]      				=	1
     lowerCamelCase__					:   Optional[Any]      				=	get_activation('gelu'			)
     self.assertEqual(acta.a    ,  1			)
     with self.assertRaises(UpperCAmelCase			):
         lowerCamelCase__					:   str      				=	acta.a





