
from __future__ import annotations


def     UpperCAmelCase_  (						__lowerCAmelCase	) ->						bool:
    __lowercase		:			str	    =       len(SCREAMING_SNAKE_CASE_	)
    # We need to create solution object to save path.
    __lowercase		:			List[Any]	    =       [[0 for _ in range(SCREAMING_SNAKE_CASE_	)] for _ in range(SCREAMING_SNAKE_CASE_	)]
    __lowercase		:			Any	    =       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     UpperCAmelCase_  (						__lowerCAmelCase	,					__lowerCAmelCase	,					__lowerCAmelCase	,					__lowerCAmelCase	) ->						bool:
    __lowercase		:			int	    =       len(SCREAMING_SNAKE_CASE_	)
    # Final check point.
    if i == j == (size - 1):
        __lowercase		:			int	    =       1
        return True

    __lowercase		:			Optional[int]	    =       (not i < 0) and (not j < 0)  # Check lower bounds
    __lowercase		:			Dict	    =       (i < size) and (j < size)  # Check upper bounds

    if lower_flag and upper_flag:
        # check for already visited and block points.
        __lowercase		:			List[Any]	    =       (not solutions[i][j]) and (not maze[i][j])
        if block_flag:
            # check visited
            __lowercase		:			List[Any]	    =       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

            __lowercase		:			int	    =       0
            return False
    return False


if __name__ == "__main__":
 import doctest

 doctest.testmod()


import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_torch


if is_torch_available():
 import torch

 from transformers.activations import gelu_new, gelu_python, get_activation


@require_torch
class 						__lowerCAmelCase	(	unittest.TestCase      ):



      """simple docstring"""







      def 		snake_case_			(      self		:       Optional[Any]				):
          __lowercase		:			Union[str, Any]	    =       torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]				)
          __lowercase		:			Any	    =       get_activation('''gelu'''				)
          self.assertTrue(torch.allclose(gelu_python(_snake_case				)				,       torch_builtin(_snake_case				)				)				)
          self.assertFalse(torch.allclose(gelu_python(_snake_case				)				,       gelu_new(_snake_case				)				)				)




      def 		snake_case_			(      self		:       Dict				):
          __lowercase		:			Any	    =       torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]				)
          __lowercase		:			List[str]	    =       get_activation('''gelu'''				)
          __lowercase		:			Optional[Any]	    =       get_activation('''gelu_10'''				)

          __lowercase		:			Tuple	    =       torch_builtin(_snake_case				)
          __lowercase		:			List[Any]	    =       geluaa(_snake_case				)

          __lowercase		:			Tuple	    =       torch.where(y_gelu_aa < 10.0				,       1				,       0				)

          self.assertTrue(torch.max(_snake_case				).item() == 10.0				)
          self.assertTrue(torch.allclose(y_gelu * clipped_mask				,       y_gelu_aa * clipped_mask				)				)




      def 		snake_case_			(      self		:       Any				):
          get_activation('''gelu'''				)
          get_activation('''gelu_10'''				)
          get_activation('''gelu_fast'''				)
          get_activation('''gelu_new'''				)
          get_activation('''gelu_python'''				)
          get_activation('''gelu_pytorch_tanh'''				)
          get_activation('''linear'''				)
          get_activation('''mish'''				)
          get_activation('''quick_gelu'''				)
          get_activation('''relu'''				)
          get_activation('''sigmoid'''				)
          get_activation('''silu'''				)
          get_activation('''swish'''				)
          get_activation('''tanh'''				)
          with self.assertRaises(_snake_case				):
              get_activation('''bogus'''				)
          with self.assertRaises(_snake_case				):
              get_activation(_snake_case				)




      def 		snake_case_			(      self		:       Dict				):
          __lowercase		:			Union[str, Any]	    =       get_activation('''gelu'''				)
          __lowercase		:			List[str]	    =       1
          __lowercase		:			Union[str, Any]	    =       get_activation('''gelu'''				)
          self.assertEqual(acta.a				,       1				)
          with self.assertRaises(_snake_case				):
              __lowercase		:			Tuple	    =       acta.a


