





'''simple docstring'''







def        lowerCamelCase_      (  SCREAMING_SNAKE_CASE__      :			Dict   ) ->	int:
						if not isinstance(__UpperCamelCase,			__UpperCamelCase   ) or number < 0:
												raise ValueError('''Input must be a non-negative integer'''   )

						UpperCAmelCase_			:      Optional[Any]     						=  0
						while number:
												# This way we arrive at next set bit (next 1) instead of looping
												# through each bit and checking for 1s hence the
												# loop won't run 32 times it will only run the number of `1` times
												number &= number - 1
												count += 1
						return count


if __name__ == "__main__":
						import doctest

						doctest.testmod()












'''simple docstring'''







import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation


class 					__a      (unittest.TestCase     ):

							def     UpperCAmelCase__	(							self							:     Dict   )					->       Dict:







													"""simple docstring"""
													UpperCAmelCase_			:      Dict     						=  get_activation('''swish'''   )

													self.assertIsInstance(__magic_name__       ,     nn.SiLU   )

													self.assertEqual(act(torch.tensor(-1_00       ,     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     UpperCAmelCase__	(							self							:     Tuple   )					->       Tuple:







													"""simple docstring"""
													UpperCAmelCase_			:      Union[str, Any]     						=  get_activation('''silu'''   )

													self.assertIsInstance(__magic_name__       ,     nn.SiLU   )

													self.assertEqual(act(torch.tensor(-1_00       ,     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     UpperCAmelCase__	(							self							:     Tuple   )					->       Optional[int]:







													"""simple docstring"""
													UpperCAmelCase_			:      Optional[int]     						=  get_activation('''mish'''   )

													self.assertIsInstance(__magic_name__       ,     nn.Mish   )

													self.assertEqual(act(torch.tensor(-2_00       ,     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     UpperCAmelCase__	(							self							:     str   )					->       Optional[Any]:







													"""simple docstring"""
													UpperCAmelCase_			:      List[Any]     						=  get_activation('''gelu'''   )

													self.assertIsInstance(__magic_name__       ,     nn.GELU   )

													self.assertEqual(act(torch.tensor(-1_00       ,     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   )





