



'''simple docstring'''
import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation


class       _lowerCAmelCase   (   unittest.TestCase				):







							'''simple docstring'''

							def 	lowercase							(self  )					->       int:
														_snake_case       =  get_activation("""swish"""  )

														self.assertIsInstance(__a  ,  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  )					->       Optional[int]:
														_snake_case       =  get_activation("""silu"""  )

														self.assertIsInstance(__a  ,  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  )					->       Optional[Any]:
														_snake_case       =  get_activation("""mish"""  )

														self.assertIsInstance(__a  ,  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]:
														_snake_case       =  get_activation("""gelu"""  )

														self.assertIsInstance(__a  ,  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 __future__ import annotations






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
							_snake_case       =  len(_SCREAMING_SNAKE_CASE				)
							# We need to create solution object to save path.
							_snake_case       =  [[0 for _ in range(_SCREAMING_SNAKE_CASE				)] for _ in range(_SCREAMING_SNAKE_CASE				)]
							_snake_case       =  run_maze(_SCREAMING_SNAKE_CASE							, 0							, 0							, _SCREAMING_SNAKE_CASE				)
							if solved:
														print("""\n""".join(str(_SCREAMING_SNAKE_CASE				) for row in solutions				)				)
							else:
														print("""No solution exists!"""				)
							return solved






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				):
							_snake_case       =  len(_SCREAMING_SNAKE_CASE				)
							# Final check point.
							if i == j == (size - 1):
														_snake_case       =  1
														return True

							_snake_case       =  (not i < 0) and (not j < 0)  # Check lower bounds
							_snake_case       =  (i < size) and (j < size)  # Check upper bounds

							if lower_flag and upper_flag:
														# check for already visited and block points.
														_snake_case       =  (not solutions[i][j]) and (not maze[i][j])
														if block_flag:
																					# check visited
																					_snake_case       =  1

																					# check for directions
																					if (
																					    run_maze(_SCREAMING_SNAKE_CASE							, i + 1							, _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				)
																					    or run_maze(_SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE							, j + 1							, _SCREAMING_SNAKE_CASE				)
																					    or run_maze(_SCREAMING_SNAKE_CASE							, i - 1							, _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				)
																					    or run_maze(_SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE							, j - 1							, _SCREAMING_SNAKE_CASE				)
																					):
																												return True

																					_snake_case       =  0
																					return False
							return False


if __name__ == "__main__":
				import doctest

				doctest.testmod()