





'''simple docstring'''


import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation
class 				a_       (    unittest.TestCase							):





     def 							lowercase__				(			self		: int						):





        """simple docstring"""




        lowercase_      :Optional[Any]         =			get_activation("swish"						)

        self.assertIsInstance(_lowerCamelCase     ,				nn.SiLU						)

        self.assertEqual(act(torch.tensor(-100     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertNotEqual(act(torch.tensor(-1     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertEqual(act(torch.tensor(0     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertEqual(act(torch.tensor(20     ,				dtype=torch.floataa						)						).item()     ,				20						)





     def 							lowercase__				(			self		: List[Any]						):





        """simple docstring"""




        lowercase_      :Tuple         =			get_activation("silu"						)

        self.assertIsInstance(_lowerCamelCase     ,				nn.SiLU						)

        self.assertEqual(act(torch.tensor(-100     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertNotEqual(act(torch.tensor(-1     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertEqual(act(torch.tensor(0     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertEqual(act(torch.tensor(20     ,				dtype=torch.floataa						)						).item()     ,				20						)





     def 							lowercase__				(			self		: Union[str, Any]						):





        """simple docstring"""




        lowercase_      :List[str]         =			get_activation("mish"						)

        self.assertIsInstance(_lowerCamelCase     ,				nn.Mish						)

        self.assertEqual(act(torch.tensor(-200     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertNotEqual(act(torch.tensor(-1     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertEqual(act(torch.tensor(0     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertEqual(act(torch.tensor(20     ,				dtype=torch.floataa						)						).item()     ,				20						)







     def 							lowercase__				(			self		: Tuple						):





        """simple docstring"""




        lowercase_      :Union[str, Any]         =			get_activation("gelu"						)

        self.assertIsInstance(_lowerCamelCase     ,				nn.GELU						)

        self.assertEqual(act(torch.tensor(-100     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertNotEqual(act(torch.tensor(-1     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertEqual(act(torch.tensor(0     ,				dtype=torch.floataa						)						).item()     ,				0						)
        self.assertEqual(act(torch.tensor(20     ,				dtype=torch.floataa						)						).item()     ,				20						)









'''simple docstring'''


def 							UpperCAmelCase_  (						__lowerCamelCase : str     ,__lowerCamelCase : str			):
   lowercase_      :Optional[Any]         =			len(__lowerCamelCase			)
   lowercase_      :List[Any]         =			[]
   for i in range(len(__lowerCamelCase			) - pat_len + 1			):
      lowercase_      :Dict         =			True
      for j in range(__lowerCamelCase			):
         if s[i + j] != pattern[j]:
            lowercase_      :int         =			False
            break
      if match_found:
         position.append(__lowerCamelCase			)
   return position


if __name__ == "__main__":
 assert naive_pattern_search('''ABCDEFG''', '''DE''') == [3]
 print(naive_pattern_search('''ABAAABCDBBABCDDEBCABC''', '''ABC'''))


