'''simple docstring'''

def 					UpperCAmelCase__      (							_lowerCAmelCase						: List[Any],			_lowerCAmelCase						: Optional[int],			_lowerCAmelCase						: Optional[Any],			_lowerCAmelCase						: Any)						->		int:



      """simple docstring"""

      return len_board * len_board_column * row + column


def 					UpperCAmelCase__      (							_lowerCAmelCase						: Any,			_lowerCAmelCase						: int,			_lowerCAmelCase						: Optional[Any],			_lowerCAmelCase						: Optional[Any],			_lowerCAmelCase						: Dict,			_lowerCAmelCase						: Optional[Any],			)						->		bool:



      """simple docstring"""

      if board[row][column] != word[word_index]:
            return False

      if word_index == len(__lowerCAmelCase) - 1:
            return True

      snake_case   :					Any							=						[(0, 1), (0, -1), (-1, 0), (1, 0)]
      snake_case   :					int							=						len(__lowerCAmelCase)
      snake_case   :					Any							=						len(board[0])
      for direction in traverts_directions:
            snake_case   :					List[Any]							=						row + direction[0]
            snake_case   :					Tuple							=						column + direction[1]
            if not (0 <= next_i < len_board and 0 <= next_j < len_board_column):
                  continue

            snake_case   :					Dict							=						get_point_key(__lowerCAmelCase,			__lowerCAmelCase,			__lowerCAmelCase,			__lowerCAmelCase)
            if key in visited_points_set:
                  continue

            visited_points_set.add(__lowerCAmelCase)
            if exits_word(__lowerCAmelCase,			__lowerCAmelCase,			__lowerCAmelCase,			__lowerCAmelCase,			word_index + 1,			__lowerCAmelCase):
                  return True

            visited_points_set.remove(__lowerCAmelCase)

      return False


def 					UpperCAmelCase__      (							_lowerCAmelCase						: List[Any],			_lowerCAmelCase						: Union[str, Any])						->		bool:



      """simple docstring"""

      snake_case   :					str							=						(
          "The board should be a non empty matrix of single chars strings."
      )

      snake_case   :					List[Any]							=						len(__lowerCAmelCase)
      if not isinstance(__lowerCAmelCase,			__lowerCAmelCase) or len(__lowerCAmelCase) == 0:
            raise ValueError(__lowerCAmelCase)

      for row in board:
            if not isinstance(__lowerCAmelCase,			__lowerCAmelCase) or len(__lowerCAmelCase) == 0:
                  raise ValueError(__lowerCAmelCase)

            for item in row:
                  if not isinstance(__lowerCAmelCase,			__lowerCAmelCase) or len(__lowerCAmelCase) != 1:
                        raise ValueError(__lowerCAmelCase)

    # Validate word
      if not isinstance(__lowerCAmelCase,			__lowerCAmelCase) or len(__lowerCAmelCase) == 0:
            raise ValueError(
                "The word parameter should be a string of length greater than 0.")

      snake_case   :					List[str]							=						len(board[0])
      for i in range(__lowerCAmelCase):
            for j in range(__lowerCAmelCase):
                  if exits_word(
                      __lowerCAmelCase,			__lowerCAmelCase,			__lowerCAmelCase,			__lowerCAmelCase,			0,			{get_point_key(__lowerCAmelCase,			__lowerCAmelCase,			__lowerCAmelCase,			__lowerCAmelCase)}):
                        return True

      return False


if __name__ == "__main__":
      import doctest

      doctest.testmod()






'''simple docstring'''

from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


A_        =   logging.get_logger(__name__)

A_        =   {
    "apple/mobilevit-small": "https://huggingface.co/apple/mobilevit-small/resolve/main/config.json",
    "apple/mobilevit-x-small": "https://huggingface.co/apple/mobilevit-x-small/resolve/main/config.json",
    "apple/mobilevit-xx-small": "https://huggingface.co/apple/mobilevit-xx-small/resolve/main/config.json",
    "apple/deeplabv3-mobilevit-small": (
        "https://huggingface.co/apple/deeplabv3-mobilevit-small/resolve/main/config.json"
    ),
    "apple/deeplabv3-mobilevit-x-small": (
        "https://huggingface.co/apple/deeplabv3-mobilevit-x-small/resolve/main/config.json"
    ),
    "apple/deeplabv3-mobilevit-xx-small": (
        "https://huggingface.co/apple/deeplabv3-mobilevit-xx-small/resolve/main/config.json"
    ),
    # See all MobileViT models at https://huggingface.co/models?filter=mobilevit
}




class 		SCREAMING_SNAKE_CASE_				(_UpperCAmelCase			):



			"""simple docstring"""






			__magic_name__   :							Optional[Any]             =					"""mobilevit"""



			def __init__(       self							, snake_case_=3							, snake_case_=256							, snake_case_=2							, snake_case_=[144, 192, 240]							, snake_case_=[16, 32, 64, 96, 128, 160, 640]							, snake_case_=4							, snake_case_=2.0							, snake_case_=4.0							, snake_case_="silu"							, snake_case_=3							, snake_case_=32							, snake_case_=0.1							, snake_case_=0.0							, snake_case_=0.1							, snake_case_=0.02							, snake_case_=1e-5							, snake_case_=True							, snake_case_=256							, snake_case_=[6, 12, 18]							, snake_case_=0.1							, snake_case_=255							, **snake_case_							, ):
									super().__init__(**snake_case_				)

									snake_case   :					Any							=						num_channels
									snake_case   :					Optional[Any]							=						image_size
									snake_case   :					Union[str, Any]							=						patch_size
									snake_case   :					Union[str, Any]							=						hidden_sizes
									snake_case   :					List[Any]							=						neck_hidden_sizes
									snake_case   :					Optional[Any]							=						num_attention_heads
									snake_case   :					Any							=						mlp_ratio
									snake_case   :					List[str]							=						expand_ratio
									snake_case   :					Tuple							=						hidden_act
									snake_case   :					Tuple							=						conv_kernel_size
									snake_case   :					int							=						output_stride
									snake_case   :					Dict							=						hidden_dropout_prob
									snake_case   :					List[str]							=						attention_probs_dropout_prob
									snake_case   :					int							=						classifier_dropout_prob
									snake_case   :					str							=						initializer_range
									snake_case   :					Optional[int]							=						layer_norm_eps
									snake_case   :					Dict							=						qkv_bias

									# decode head attributes for semantic segmentation
									snake_case   :					Optional[int]							=						aspp_out_channels
									snake_case   :					Dict							=						atrous_rates
									snake_case   :					Any							=						aspp_dropout_prob
									snake_case   :					Any							=						semantic_loss_ignore_index







class 		SCREAMING_SNAKE_CASE_				(_UpperCAmelCase			):



			"""simple docstring"""






			__magic_name__   :							Union[str, Any]             =					version.parse("""1.11"""			)



			@property
			def      lowerCamelCase   (       self				):
									return OrderedDict([("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"})]				)



			@property
			def      lowerCamelCase   (       self				):
									if self.task == "image-classification":
															return OrderedDict([("logits", {0: "batch"})]				)
									else:
															return OrderedDict([("last_hidden_state", {0: "batch"}), ("pooler_output", {0: "batch"})]				)






			@property
			def      lowerCamelCase   (       self				):
									return 1e-4





