


'''simple docstring'''

def 							SCREAMING_SNAKE_CASE__(		_UpperCamelCase   :					list     ,		_UpperCamelCase   :					int     ,		_UpperCamelCase   :					int     ,		_UpperCamelCase   :					int )		->       int:





   '''simple docstring'''







   UpperCamelCase__			    =    int((lower_bound + upper_bound) // 2 )
   if array[r] == value:
      return r
   if lower_bound >= upper_bound:
      return -1
   if array[r] < value:
      return binary_search(_UpperCamelCase     ,		r + 1     ,		_UpperCamelCase     ,		_UpperCamelCase )
   else:
      return binary_search(_UpperCamelCase     ,		_UpperCamelCase     ,		r - 1     ,		_UpperCamelCase )



def 							SCREAMING_SNAKE_CASE__(		_UpperCamelCase   :					int     ,		_UpperCamelCase   :					list )		->       list:





   '''simple docstring'''







   UpperCamelCase__			    =    0
   if matrix[index][0] == value:
      return [index, 0]
   while index < len(_UpperCamelCase ) and matrix[index][0] < value:
      UpperCamelCase__			    =    binary_search(matrix[index]     ,		0     ,		len(matrix[index] ) - 1     ,		_UpperCamelCase )
      if r != -1:
         return [index, r]
      index += 1
   return [-1, -1]


if __name__ == "__main__":
       import doctest

       doctest.testmod()



'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


__lowercase:		Tuple    						=  {
    "configuration_imagegpt": ["IMAGEGPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ImageGPTConfig", "ImageGPTOnnxConfig"]
}

try:
       if not is_vision_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowercase:		List[str]    						=  ["ImageGPTFeatureExtractor"]
       __lowercase:		Tuple    						=  ["ImageGPTImageProcessor"]

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowercase:		str    						=  [
           "IMAGEGPT_PRETRAINED_MODEL_ARCHIVE_LIST",
           "ImageGPTForCausalImageModeling",
           "ImageGPTForImageClassification",
           "ImageGPTModel",
           "ImageGPTPreTrainedModel",
           "load_tf_weights_in_imagegpt",
       ]


if TYPE_CHECKING:
       from .configuration_imagegpt import IMAGEGPT_PRETRAINED_CONFIG_ARCHIVE_MAP, ImageGPTConfig, ImageGPTOnnxConfig

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .feature_extraction_imagegpt import ImageGPTFeatureExtractor
              from .image_processing_imagegpt import ImageGPTImageProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_imagegpt import (
                  IMAGEGPT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  ImageGPTForCausalImageModeling,
                  ImageGPTForImageClassification,
                  ImageGPTModel,
                  ImageGPTPreTrainedModel,
                  load_tf_weights_in_imagegpt,
              )

else:
       import sys

       __lowercase:		List[str]    						=  _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)