'''simple docstring'''





from typing import Any






class 				UpperCAmelCase :




    '''simple docstring'''







    def __init__(       self    ,							lowercase__ )							-> Dict:
         SCREAMING_SNAKE_CASE					:			Optional[int]    	=       data
         SCREAMING_SNAKE_CASE					:			Union[str, Any]    	=       None






class 				UpperCAmelCase :




    '''simple docstring'''







    def __init__(       self )							-> int:
         SCREAMING_SNAKE_CASE					:			int    	=       None






    def       _UpperCamelCase    (       self )							-> Dict:
         SCREAMING_SNAKE_CASE					:			int    	=       self.head
         while temp is not None:
              print(temp.data    ,							end=' ' )
              SCREAMING_SNAKE_CASE					:			Dict    	=       temp.next
         print()






    def       _UpperCamelCase    (       self    ,							lowercase__ )							-> Union[str, Any]:
         SCREAMING_SNAKE_CASE					:			List[str]    	=       Node(lowercase__ )
         SCREAMING_SNAKE_CASE					:			Dict    	=       self.head
         SCREAMING_SNAKE_CASE					:			List[str]    	=       new_node






    def       _UpperCamelCase    (       self    ,							lowercase__    ,							lowercase__ )							-> Dict:
         if node_data_a == node_data_a:
              return
         else:
              SCREAMING_SNAKE_CASE					:			List[Any]    	=       self.head
              while node_a is not None and node_a.data != node_data_a:
                   SCREAMING_SNAKE_CASE					:			Dict    	=       node_a.next

              SCREAMING_SNAKE_CASE					:			int    	=       self.head
              while node_a is not None and node_a.data != node_data_a:
                   SCREAMING_SNAKE_CASE					:			Dict    	=       node_a.next

              if node_a is None or node_a is None:
                   return

              SCREAMING_SNAKE_CASE	,   SCREAMING_SNAKE_CASE					:			Union[str, Any]    	=       node_a.data, node_a.data


if __name__ == "__main__":
 _lowerCAmelCase  :int  				=    LinkedList()
 for i in range(5, 0, -1):
  ll.push(i)

 ll.print_list()

 ll.swap_nodes(1, 4)
 print("""After swapping""")
 ll.print_list()




'''simple docstring'''





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 				UpperCAmelCase (       unittest.TestCase ):




    '''simple docstring'''







    def       _UpperCamelCase    (       self )							-> int:
         SCREAMING_SNAKE_CASE					:			str    	=       torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100] )
         SCREAMING_SNAKE_CASE					:			str    	=       get_activation('gelu' )
         self.assertTrue(torch.allclose(gelu_python(lowercase__ )    ,							torch_builtin(lowercase__ ) ) )
         self.assertFalse(torch.allclose(gelu_python(lowercase__ )    ,							gelu_new(lowercase__ ) ) )






    def       _UpperCamelCase    (       self )							-> Optional[Any]:
         SCREAMING_SNAKE_CASE					:			Union[str, Any]    	=       torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100] )
         SCREAMING_SNAKE_CASE					:			str    	=       get_activation('gelu' )
         SCREAMING_SNAKE_CASE					:			Dict    	=       get_activation('gelu_10' )

         SCREAMING_SNAKE_CASE					:			Optional[int]    	=       torch_builtin(lowercase__ )
         SCREAMING_SNAKE_CASE					:			str    	=       geluaa(lowercase__ )

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

         self.assertTrue(torch.max(lowercase__ ).item() == 1_0.0 )
         self.assertTrue(torch.allclose(y_gelu * clipped_mask    ,							y_gelu_aa * clipped_mask ) )






    def       _UpperCamelCase    (       self )							-> Optional[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(lowercase__ ):
              get_activation('bogus' )
         with self.assertRaises(lowercase__ ):
              get_activation(lowercase__ )






    def       _UpperCamelCase    (       self )							-> int:
         SCREAMING_SNAKE_CASE					:			Optional[int]    	=       get_activation('gelu' )
         SCREAMING_SNAKE_CASE					:			str    	=       1
         SCREAMING_SNAKE_CASE					:			List[str]    	=       get_activation('gelu' )
         self.assertEqual(acta.a    ,							1 )
         with self.assertRaises(lowercase__ ):
              SCREAMING_SNAKE_CASE					:			Dict    	=       acta.a



