





'''simple docstring'''




import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation


class 			SCREAMING_SNAKE_CASE   (unittest.TestCase							):


     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						:			Optional[int]								=	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 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						:			Tuple								=	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 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						:			int								=	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 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						:			int								=	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'''




from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
  if not (is_transformers_available() and is_torch_available()):
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  from ...utils.dummy_torch_and_transformers_objects import ShapEPipeline
else:
  from .camera import create_pan_cameras
  from .pipeline_shap_e import ShapEPipeline
  from .pipeline_shap_e_img2img import ShapEImgaImgPipeline
  from .renderer import (
      BoundingBoxVolume,
      ImportanceRaySampler,
      MLPNeRFModelOutput,
      MLPNeRSTFModel,
      ShapEParamsProjModel,
      ShapERenderer,
      StratifiedRaySampler,
      VoidNeRFModel,
  )