


import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
UpperCAmelCase_				:			int   =	sys.version_info >= (3, 10)







def 	SCREAMING_SNAKE_CASE_						(      __A			:      str=None  ,   __A			:      str=None    )     ->		str:

       """simple docstring"""

       return field(default_factory=lambda: default  ,   metadata=__A    )
@dataclass
class 			SCREAMING_SNAKE_CASE__  :
      snake_case__    :					int
      snake_case__    :					float
      snake_case__    :					str
      snake_case__    :					bool
@dataclass
class 			SCREAMING_SNAKE_CASE__  :
      snake_case__    :					int					       =						42
      snake_case__    :					str					       =						field(default='''toto'''						,   metadata={'''help''': '''help message'''}      )
@dataclass
class 			SCREAMING_SNAKE_CASE__  :
      snake_case__    :					bool					       =						False
      snake_case__    :					bool					       =						True
      snake_case__    :					Optional[bool]					       =						None
class 			SCREAMING_SNAKE_CASE__  (    lowercase__      ):
      snake_case__    :					Union[str, Any]					       =						'''titi'''
      snake_case__    :					Union[str, Any]					       =						'''toto'''
class 			SCREAMING_SNAKE_CASE__  (    lowercase__      ):
      snake_case__    :					int					       =						'''titi'''
      snake_case__    :					List[str]					       =						'''toto'''
      snake_case__    :					Optional[Any]					       =						42
@dataclass
class 			SCREAMING_SNAKE_CASE__  :
      snake_case__    :					BasicEnum					       =						"toto"
      def 	SCREAMING_SNAKE_CASE							(	self    :	Optional[Any]					)		->      Any:
             a_ :		List[Any]							=  BasicEnum(self.foo					)
@dataclass
class 			SCREAMING_SNAKE_CASE__  :
      snake_case__    :					MixedTypeEnum					       =						"toto"
      def 	SCREAMING_SNAKE_CASE							(	self    :	List[Any]					)		->      Dict:
             a_ :		Optional[int]							=  MixedTypeEnum(self.foo					)
@dataclass
class 			SCREAMING_SNAKE_CASE__  :
      snake_case__    :					Optional[int]					       =						None
      snake_case__    :					Optional[float]					       =						field(default=lowercase__						,   metadata={'''help''': '''help message'''}      )
      snake_case__    :					Optional[str]					       =						None
      snake_case__    :					Optional[List[str]]					       =						list_field(default=[]      )
      snake_case__    :					Optional[List[int]]					       =						list_field(default=[]      )
@dataclass
class 			SCREAMING_SNAKE_CASE__  :
      snake_case__    :					List[int]					       =						list_field(default=[]      )
      snake_case__    :					List[int]					       =						list_field(default=[1, 2, 3]      )
      snake_case__    :					List[str]					       =						list_field(default=['''Hallo''', '''Bonjour''', '''Hello''']      )
      snake_case__    :					List[float]					       =						list_field(default=[0.1, 0.2, 0.3]      )
@dataclass
class 			SCREAMING_SNAKE_CASE__  :
      snake_case__    :					List[int]					       =						field()
      snake_case__    :					str					       =						field()
      snake_case__    :					BasicEnum					       =						field()
      def 	SCREAMING_SNAKE_CASE							(	self    :	List[Any]					)		->      Optional[Any]:
             a_ :		Union[str, Any]							=  BasicEnum(self.required_enum					)
@dataclass
class 			SCREAMING_SNAKE_CASE__  :
      snake_case__    :					int
      snake_case__    :					"BasicEnum"					       =						field()
      snake_case__    :					"Optional[bool]"					       =						None
      snake_case__    :					"str"					       =						field(default='''toto'''						,   metadata={'''help''': '''help message'''}      )
      snake_case__    :					"List[str]"					       =						list_field(default=['''Hallo''', '''Bonjour''', '''Hello''']      )


if is_python_no_less_than_3_10:
   @dataclass
   class 			SCREAMING_SNAKE_CASE__  :
         snake_case__    :					bool					       =						False
         snake_case__    :					bool					       =						True
         snake_case__    :					bool | None					       =						None
   @dataclass
   class 			SCREAMING_SNAKE_CASE__  :
         snake_case__    :					int | None					       =						None
         snake_case__    :					float | None					       =						field(default=lowercase__						,   metadata={'''help''': '''help message'''}      )
         snake_case__    :					str | None					       =						None
         snake_case__    :					list[str] | None					       =						list_field(default=[]      )
         snake_case__    :					list[int] | None					       =						list_field(default=[]      )
class 			SCREAMING_SNAKE_CASE__  (    unittest.TestCase      ):
      def 	SCREAMING_SNAKE_CASE							(	self    :	Dict					,							SCREAMING_SNAKE_CASE__    :	argparse.ArgumentParser					,							SCREAMING_SNAKE_CASE__    :	argparse.ArgumentParser					)		->      int:
             self.assertEqual(len(a._actions					)					,							len(b._actions					)					)
             for x, y in zip(a._actions					,							b._actions					):
                    a_ :		Any							=  {k: v for k, v in vars(SCREAMING_SNAKE_CASE__					).items() if k != 'container'}
                    a_ :		int							=  {k: v for k, v in vars(SCREAMING_SNAKE_CASE__					).items() if k != 'container'}

                    # Choices with mixed type have custom function as "type"
                    # So we need to compare results directly for equality
                    if xx.get('choices'					,							SCREAMING_SNAKE_CASE__					) and yy.get('choices'					,							SCREAMING_SNAKE_CASE__					):
                           for expected_choice in yy["choices"] + xx["choices"]:
                                  self.assertEqual(xx['type'](SCREAMING_SNAKE_CASE__					)					,							yy['type'](SCREAMING_SNAKE_CASE__					)					)
                           del xx["type"], yy["type"]

                    self.assertEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Any					)		->      List[str]:
             a_ :		Optional[Any]							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		Any							=  argparse.ArgumentParser()
             expected.add_argument('--foo'					,							type=SCREAMING_SNAKE_CASE__					,							required=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--bar'					,							type=SCREAMING_SNAKE_CASE__					,							required=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--baz'					,							type=SCREAMING_SNAKE_CASE__					,							required=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--flag'					,							type=SCREAMING_SNAKE_CASE__					,							default=SCREAMING_SNAKE_CASE__					,							const=SCREAMING_SNAKE_CASE__					,							nargs='?'					)
             self.argparsersEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)

             a_ :		int							=  ['--foo', '1', '--baz', 'quux', '--bar', '0.5']
             (a_		) :		str							=  parser.parse_args_into_dataclasses(SCREAMING_SNAKE_CASE__					,							look_for_args_file=SCREAMING_SNAKE_CASE__					)
             self.assertFalse(example.flag					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Union[str, Any]					)		->      List[Any]:
             a_ :		int							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		Union[str, Any]							=  argparse.ArgumentParser()
             expected.add_argument('--foo'					,							default=4_2					,							type=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--baz'					,							default='toto'					,							type=SCREAMING_SNAKE_CASE__					,							help='help message'					)
             self.argparsersEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	str					)		->      List[Any]:
             a_ :		str							=  argparse.ArgumentParser()
             expected.add_argument('--foo'					,							type=SCREAMING_SNAKE_CASE__					,							default=SCREAMING_SNAKE_CASE__					,							const=SCREAMING_SNAKE_CASE__					,							nargs='?'					)
             expected.add_argument('--baz'					,							type=SCREAMING_SNAKE_CASE__					,							default=SCREAMING_SNAKE_CASE__					,							const=SCREAMING_SNAKE_CASE__					,							nargs='?'					)
             # A boolean no_* argument always has to come after its "default: True" regular counter-part
             # and its default must be set to False
             expected.add_argument('--no_baz'					,							action='store_false'					,							default=SCREAMING_SNAKE_CASE__					,							dest='baz'					)
             expected.add_argument('--opt'					,							type=SCREAMING_SNAKE_CASE__					,							default=SCREAMING_SNAKE_CASE__					)

             a_ :		Union[str, Any]							=  [WithDefaultBoolExample]
             if is_python_no_less_than_3_10:
                    dataclass_types.append(SCREAMING_SNAKE_CASE__					)

             for dataclass_type in dataclass_types:
                    a_ :		List[Any]							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)
                    self.argparsersEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)

                    a_ :		str							=  parser.parse_args([]					)
                    self.assertEqual(SCREAMING_SNAKE_CASE__					,							Namespace(foo=SCREAMING_SNAKE_CASE__					,							baz=SCREAMING_SNAKE_CASE__					,							opt=SCREAMING_SNAKE_CASE__					)					)

                    a_ :		Any							=  parser.parse_args(['--foo', '--no_baz']					)
                    self.assertEqual(SCREAMING_SNAKE_CASE__					,							Namespace(foo=SCREAMING_SNAKE_CASE__					,							baz=SCREAMING_SNAKE_CASE__					,							opt=SCREAMING_SNAKE_CASE__					)					)

                    a_ :		str							=  parser.parse_args(['--foo', '--baz']					)
                    self.assertEqual(SCREAMING_SNAKE_CASE__					,							Namespace(foo=SCREAMING_SNAKE_CASE__					,							baz=SCREAMING_SNAKE_CASE__					,							opt=SCREAMING_SNAKE_CASE__					)					)

                    a_ :		Optional[int]							=  parser.parse_args(['--foo', 'True', '--baz', 'True', '--opt', 'True']					)
                    self.assertEqual(SCREAMING_SNAKE_CASE__					,							Namespace(foo=SCREAMING_SNAKE_CASE__					,							baz=SCREAMING_SNAKE_CASE__					,							opt=SCREAMING_SNAKE_CASE__					)					)

                    a_ :		Optional[int]							=  parser.parse_args(['--foo', 'False', '--baz', 'False', '--opt', 'False']					)
                    self.assertEqual(SCREAMING_SNAKE_CASE__					,							Namespace(foo=SCREAMING_SNAKE_CASE__					,							baz=SCREAMING_SNAKE_CASE__					,							opt=SCREAMING_SNAKE_CASE__					)					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Optional[int]					)		->      List[Any]:
             a_ :		List[Any]							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		List[str]							=  argparse.ArgumentParser()
             expected.add_argument(
                 '--foo'					,							default='toto'					,							choices=['titi', 'toto', 4_2]					,							type=make_choice_type_function(['titi', 'toto', 4_2]					)					,							)
             self.argparsersEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)

             a_ :		Tuple							=  parser.parse_args([]					)
             self.assertEqual(args.foo					,							'toto'					)
             a_ :		Dict							=  parser.parse_args_into_dataclasses([]					)[0]
             self.assertEqual(enum_ex.foo					,							MixedTypeEnum.toto					)

             a_ :		int							=  parser.parse_args(['--foo', 'titi']					)
             self.assertEqual(args.foo					,							'titi'					)
             a_ :		List[Any]							=  parser.parse_args_into_dataclasses(['--foo', 'titi']					)[0]
             self.assertEqual(enum_ex.foo					,							MixedTypeEnum.titi					)

             a_ :		int							=  parser.parse_args(['--foo', '42']					)
             self.assertEqual(args.foo					,							4_2					)
             a_ :		Any							=  parser.parse_args_into_dataclasses(['--foo', '42']					)[0]
             self.assertEqual(enum_ex.foo					,							MixedTypeEnum.fourtytwo					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Union[str, Any]					)		->      Any:
             @dataclass
             class 			SCREAMING_SNAKE_CASE__  :
                   snake_case__    :					Literal["titi", "toto", 42]					       =						"toto"
             a_ :		int							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		List[str]							=  argparse.ArgumentParser()
             expected.add_argument(
                 '--foo'					,							default='toto'					,							choices=('titi', 'toto', 4_2)					,							type=make_choice_type_function(['titi', 'toto', 4_2]					)					,							)
             self.argparsersEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)

             a_ :		Optional[Any]							=  parser.parse_args([]					)
             self.assertEqual(args.foo					,							'toto'					)

             a_ :		Optional[Any]							=  parser.parse_args(['--foo', 'titi']					)
             self.assertEqual(args.foo					,							'titi'					)

             a_ :		int							=  parser.parse_args(['--foo', '42']					)
             self.assertEqual(args.foo					,							4_2					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	int					)		->      Optional[Any]:
             a_ :		str							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		Optional[int]							=  argparse.ArgumentParser()
             expected.add_argument('--foo_int'					,							nargs='+'					,							default=[]					,							type=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--bar_int'					,							nargs='+'					,							default=[1, 2, 3]					,							type=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--foo_str'					,							nargs='+'					,							default=['Hallo', 'Bonjour', 'Hello']					,							type=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--foo_float'					,							nargs='+'					,							default=[0.1, 0.2, 0.3]					,							type=SCREAMING_SNAKE_CASE__					)

             self.argparsersEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)

             a_ :		List[Any]							=  parser.parse_args([]					)
             self.assertEqual(
                 SCREAMING_SNAKE_CASE__					,							Namespace(foo_int=[]					,							bar_int=[1, 2, 3]					,							foo_str=['Hallo', 'Bonjour', 'Hello']					,							foo_float=[0.1, 0.2, 0.3]					)					,							)

             a_ :		Tuple							=  parser.parse_args('--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7'.split()					)
             self.assertEqual(SCREAMING_SNAKE_CASE__					,							Namespace(foo_int=[1]					,							bar_int=[2, 3]					,							foo_str=['a', 'b', 'c']					,							foo_float=[0.1, 0.7]					)					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	str					)		->      Dict:
             a_ :		Optional[int]							=  argparse.ArgumentParser()
             expected.add_argument('--foo'					,							default=SCREAMING_SNAKE_CASE__					,							type=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--bar'					,							default=SCREAMING_SNAKE_CASE__					,							type=SCREAMING_SNAKE_CASE__					,							help='help message'					)
             expected.add_argument('--baz'					,							default=SCREAMING_SNAKE_CASE__					,							type=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--ces'					,							nargs='+'					,							default=[]					,							type=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--des'					,							nargs='+'					,							default=[]					,							type=SCREAMING_SNAKE_CASE__					)

             a_ :		List[str]							=  [OptionalExample]
             if is_python_no_less_than_3_10:
                    dataclass_types.append(SCREAMING_SNAKE_CASE__					)

             for dataclass_type in dataclass_types:
                    a_ :		Optional[int]							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

                    self.argparsersEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)

                    a_ :		Optional[int]							=  parser.parse_args([]					)
                    self.assertEqual(SCREAMING_SNAKE_CASE__					,							Namespace(foo=SCREAMING_SNAKE_CASE__					,							bar=SCREAMING_SNAKE_CASE__					,							baz=SCREAMING_SNAKE_CASE__					,							ces=[]					,							des=[]					)					)

                    a_ :		Optional[Any]							=  parser.parse_args('--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3'.split()					)
                    self.assertEqual(SCREAMING_SNAKE_CASE__					,							Namespace(foo=1_2					,							bar=3.14					,							baz='42'					,							ces=['a', 'b', 'c']					,							des=[1, 2, 3]					)					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	int					)		->      Optional[int]:
             a_ :		Tuple							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		Union[str, Any]							=  argparse.ArgumentParser()
             expected.add_argument('--required_list'					,							nargs='+'					,							type=SCREAMING_SNAKE_CASE__					,							required=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--required_str'					,							type=SCREAMING_SNAKE_CASE__					,							required=SCREAMING_SNAKE_CASE__					)
             expected.add_argument(
                 '--required_enum'					,							type=make_choice_type_function(['titi', 'toto']					)					,							choices=['titi', 'toto']					,							required=SCREAMING_SNAKE_CASE__					,							)
             self.argparsersEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	List[Any]					)		->      Any:
             a_ :		Optional[Any]							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		List[Any]							=  argparse.ArgumentParser()
             expected.add_argument('--foo'					,							type=SCREAMING_SNAKE_CASE__					,							required=SCREAMING_SNAKE_CASE__					)
             expected.add_argument(
                 '--required_enum'					,							type=make_choice_type_function(['titi', 'toto']					)					,							choices=['titi', 'toto']					,							required=SCREAMING_SNAKE_CASE__					,							)
             expected.add_argument('--opt'					,							type=SCREAMING_SNAKE_CASE__					,							default=SCREAMING_SNAKE_CASE__					)
             expected.add_argument('--baz'					,							default='toto'					,							type=SCREAMING_SNAKE_CASE__					,							help='help message'					)
             expected.add_argument('--foo_str'					,							nargs='+'					,							default=['Hallo', 'Bonjour', 'Hello']					,							type=SCREAMING_SNAKE_CASE__					)
             self.argparsersEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Optional[int]					)		->      Optional[Any]:
             a_ :		int							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		int							=  {
                 'foo': 1_2,
                 'bar': 3.14,
                 'baz': '42',
                 'flag': True,
             }

             a_ :		List[str]							=  parser.parse_dict(SCREAMING_SNAKE_CASE__					)[0]
             a_ :		Optional[int]							=  BasicExample(**SCREAMING_SNAKE_CASE__					)
             self.assertEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Dict					)		->      List[Any]:
             a_ :		List[str]							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		Optional[int]							=  {
                 'foo': 1_2,
                 'bar': 3.14,
                 'baz': '42',
                 'flag': True,
                 'extra': 4_2,
             }

             self.assertRaises(SCREAMING_SNAKE_CASE__					,							parser.parse_dict					,							SCREAMING_SNAKE_CASE__					,							allow_extra_keys=SCREAMING_SNAKE_CASE__					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Tuple					)		->      Dict:
             a_ :		List[str]							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		Optional[Any]							=  {
                 'foo': 1_2,
                 'bar': 3.14,
                 'baz': '42',
                 'flag': True,
             }
             with tempfile.TemporaryDirectory() as tmp_dir:
                    a_ :		Optional[Any]							=  os.path.join(SCREAMING_SNAKE_CASE__					,							'temp_json'					)
                    os.mkdir(SCREAMING_SNAKE_CASE__					)
                    with open(temp_local_path + '.json'					,							'w+'					) as f:
                           json.dump(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)
                    a_ :		int							=  parser.parse_yaml_file(Path(temp_local_path + '.json'					)					)[0]

             a_ :		Optional[Any]							=  BasicExample(**SCREAMING_SNAKE_CASE__					)
             self.assertEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Optional[Any]					)		->      Optional[Any]:
             a_ :		Any							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)

             a_ :		int							=  {
                 'foo': 1_2,
                 'bar': 3.14,
                 'baz': '42',
                 'flag': True,
             }
             with tempfile.TemporaryDirectory() as tmp_dir:
                    a_ :		int							=  os.path.join(SCREAMING_SNAKE_CASE__					,							'temp_yaml'					)
                    os.mkdir(SCREAMING_SNAKE_CASE__					)
                    with open(temp_local_path + '.yaml'					,							'w+'					) as f:
                           yaml.dump(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)
                    a_ :		Dict							=  parser.parse_yaml_file(Path(temp_local_path + '.yaml'					)					)[0]
             a_ :		int							=  BasicExample(**SCREAMING_SNAKE_CASE__					)
             self.assertEqual(SCREAMING_SNAKE_CASE__					,							SCREAMING_SNAKE_CASE__					)

      def 	SCREAMING_SNAKE_CASE							(	self    :	Optional[int]					)		->      Union[str, Any]:
             a_ :		Any							=  HfArgumentParser(SCREAMING_SNAKE_CASE__					)
             self.assertIsNotNone(SCREAMING_SNAKE_CASE__					)








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 			SCREAMING_SNAKE_CASE__  (    unittest.TestCase      ):
      def 	SCREAMING_SNAKE_CASE							(	self    :	Dict					)		->      List[str]:
             a_ :		List[str]							=  torch.tensor([-1_0_0, -1, -0.1, 0, 0.1, 1.0, 1_0_0]					)
             a_ :		Union[str, Any]							=  get_activation('gelu'					)
             self.assertTrue(torch.allclose(gelu_python(SCREAMING_SNAKE_CASE__					)					,							torch_builtin(SCREAMING_SNAKE_CASE__					)					)					)
             self.assertFalse(torch.allclose(gelu_python(SCREAMING_SNAKE_CASE__					)					,							gelu_new(SCREAMING_SNAKE_CASE__					)					)					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Union[str, Any]					)		->      Any:
             a_ :		List[str]							=  torch.tensor([-1_0_0, -1, -0.1, 0, 0.1, 1.0, 1_0_0]					)
             a_ :		Union[str, Any]							=  get_activation('gelu'					)
             a_ :		str							=  get_activation('gelu_10'					)

             a_ :		Tuple							=  torch_builtin(SCREAMING_SNAKE_CASE__					)
             a_ :		str							=  geluaa(SCREAMING_SNAKE_CASE__					)

             a_ :		List[Any]							=  torch.where(y_gelu_aa < 10.0					,							1					,							0					)

             self.assertTrue(torch.max(SCREAMING_SNAKE_CASE__					).item() == 10.0					)
             self.assertTrue(torch.allclose(y_gelu * clipped_mask					,							y_gelu_aa * clipped_mask					)					)
      def 	SCREAMING_SNAKE_CASE							(	self    :	Dict					)		->      List[Any]:
             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(SCREAMING_SNAKE_CASE__					):
                    get_activation('bogus'					)
             with self.assertRaises(SCREAMING_SNAKE_CASE__					):
                    get_activation(SCREAMING_SNAKE_CASE__					)

      def 	SCREAMING_SNAKE_CASE							(	self    :	str					)		->      str:
             a_ :		Any							=  get_activation('gelu'					)
             a_ :		Any							=  1
             a_ :		int							=  get_activation('gelu'					)
             self.assertEqual(acta.a					,							1					)
             with self.assertRaises(SCREAMING_SNAKE_CASE__					):
                    a_ :		Tuple							=  acta.a


