



'''simple docstring'''

import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation

class      __magic_name__						(   unittest.TestCase       ):







							def 							__lowercase      (							self :	str		):
									_a					:				List[Any]				=							get_activation('swish'		)

									self.assertIsInstance(_UpperCAmelCase     ,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 :	Dict		):
									_a					:				Union[str, Any]				=							get_activation('silu'		)

									self.assertIsInstance(_UpperCAmelCase     ,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 :	Tuple		):
									_a					:				Any				=							get_activation('mish'		)

									self.assertIsInstance(_UpperCAmelCase     ,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 :	List[str]		):
									_a					:				Dict				=							get_activation('gelu'		)

									self.assertIsInstance(_UpperCAmelCase     ,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 					__lowerCamelCase					(				lowerCAmelCase_  )      ->				list:
		if any(not isinstance(lowerCAmelCase_						,      lowerCAmelCase_  ) or x < 0 for x in sequence  ):
				raise TypeError('Sequence must be list of non-negative integers'  )
		for _ in range(len(lowerCAmelCase_  )  ):
				for i, (rod_upper, rod_lower) in enumerate(zip(lowerCAmelCase_						,      sequence[1:]  )  ):
						if rod_upper > rod_lower:
								sequence[i] -= rod_upper - rod_lower
								sequence[i + 1] += rod_upper - rod_lower
		return sequence


if __name__ == "__main__":
							assert bead_sort([5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5]
							assert bead_sort([7, 9, 4, 3, 5]) == [3, 4, 5, 7, 9]




