





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






       """simple docstring"""





       def snake_case__		(				self  :						Any	)       ->	List[str]:

            '''simple docstring'''




            _UpperCamelCase							       =			torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]	)
            _UpperCamelCase							       =			get_activation('''gelu'''	)
            self.assertTrue(torch.allclose(gelu_python(lowerCAmelCase__	)			,					torch_builtin(lowerCAmelCase__	)	)	)
            self.assertFalse(torch.allclose(gelu_python(lowerCAmelCase__	)			,					gelu_new(lowerCAmelCase__	)	)	)





       def snake_case__		(				self  :						int	)       ->	List[Any]:

            '''simple docstring'''




            _UpperCamelCase							       =			torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]	)
            _UpperCamelCase							       =			get_activation('''gelu'''	)
            _UpperCamelCase							       =			get_activation('''gelu_10'''	)

            _UpperCamelCase							       =			torch_builtin(lowerCAmelCase__	)
            _UpperCamelCase							       =			geluaa(lowerCAmelCase__	)

            _UpperCamelCase							       =			torch.where(y_gelu_aa < 10.0			,					1			,					0	)

            self.assertTrue(torch.max(lowerCAmelCase__	).item() == 10.0	)
            self.assertTrue(torch.allclose(y_gelu * clipped_mask			,					y_gelu_aa * clipped_mask	)	)





       def snake_case__		(				self  :						Dict	)       ->	int:

            '''simple docstring'''




            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(lowerCAmelCase__	):
                 get_activation('''bogus'''	)
            with self.assertRaises(lowerCAmelCase__	):
                 get_activation(lowerCAmelCase__	)







       def snake_case__		(				self  :						List[str]	)       ->	Optional[int]:

            '''simple docstring'''




            _UpperCamelCase							       =			get_activation('''gelu'''	)
            _UpperCamelCase							       =			1
            _UpperCamelCase							       =			get_activation('''gelu'''	)
            self.assertEqual(acta.a			,					1	)
            with self.assertRaises(lowerCAmelCase__	):
                 _UpperCamelCase							       =			acta.a




'''simple docstring'''

from __future__ import annotations

from typing import Any



def snake_case_      (					__snake_case  :							list[Any])			->					None:
   create_state_space_tree(__snake_case	,   []	,   0)



def snake_case_      (					__snake_case  :							list[Any]	,   __snake_case  :							list[Any]	,   __snake_case  :							int)			->					None:

   if index == len(__snake_case):
      print(__snake_case)
      return

   create_state_space_tree(__snake_case	,   __snake_case	,   index + 1)
   current_subsequence.append(sequence[index])
   create_state_space_tree(__snake_case	,   __snake_case	,   index + 1)
   current_subsequence.pop()


if __name__ == "__main__":
 A_     :						list[Any]    							=[3, 1, 2, 4]
 generate_all_subsequences(seq)

 seq.clear()
 seq.extend(['''A''', '''B''', '''C'''])
 generate_all_subsequences(seq)





