



'''simple docstring'''





import numpy as np

from transformers import Pipeline





def 						__snake_case(				_lowerCAmelCase		)		-> Optional[int]:
      snake_case__  :    Optional[Any]    						=      np.max(_lowerCAmelCase     ,   axis=-1     ,   keepdims=_lowerCAmelCase		)
      snake_case__  :    List[str]    						=      np.exp(outputs - maxes		)
      return shifted_exp / shifted_exp.sum(axis=-1     ,   keepdims=_lowerCAmelCase		)







class     UpperCAmelCase_       (       _a	):
    """simple docstring"""







    def lowerCamelCase       (    self					:     Optional[Any] ,     **snake_case_					:     int						):
          snake_case__  :    Optional[int]    						=      {}
          if "second_text" in kwargs:
                snake_case__  :    Union[str, Any]    						=      kwargs["""second_text"""]
          return preprocess_kwargs, {}, {}




    def lowerCamelCase       (    self					:     str ,     snake_case_					:     Tuple ,     snake_case_					:     Union[str, Any]=None						):
          return self.tokenizer(snake_case_ ,     text_pair=snake_case_ ,     return_tensors=self.framework						)




    def lowerCamelCase       (    self					:     List[Any] ,     snake_case_					:     Dict						):
          return self.model(**snake_case_						)




    def lowerCamelCase       (    self					:     int ,     snake_case_					:     List[Any]						):
          snake_case__  :    Union[str, Any]    						=      model_outputs.logits[0].numpy()
          snake_case__  :    List[str]    						=      softmax(snake_case_						)

          snake_case__  :    List[str]    						=      np.argmax(snake_case_						)
          snake_case__  :    List[str]    						=      self.model.config.idalabel[best_class]
          snake_case__  :    Optional[int]    						=      probabilities[best_class].item()
          snake_case__  :    str    						=      logits.tolist()
          return {"label": label, "score": score, "logits": logits}





'''simple docstring'''





from ...configuration_utils import PretrainedConfig
from ...utils import logging


__a          =		logging.get_logger(__name__)

__a          =		{
    "vinvino02/glpn-kitti": "https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json",
    # See all GLPN models at https://huggingface.co/models?filter=glpn
}







class     UpperCAmelCase_       (       _a	):
    """simple docstring"""







    lowercase					=		"glpn"




    def __init__(    self					:     Optional[Any] ,     snake_case_					:     List[str]=3 ,     snake_case_					:     Dict=4 ,     snake_case_					:     List[Any]=[2, 2, 2, 2] ,     snake_case_					:     int=[8, 4, 2, 1] ,     snake_case_					:     List[str]=[32, 64, 160, 256] ,     snake_case_					:     Tuple=[7, 3, 3, 3] ,     snake_case_					:     List[Any]=[4, 2, 2, 2] ,     snake_case_					:     Tuple=[1, 2, 5, 8] ,     snake_case_					:     List[str]=[4, 4, 4, 4] ,     snake_case_					:     Optional[int]="gelu" ,     snake_case_					:     Dict=0.0 ,     snake_case_					:     Union[str, Any]=0.0 ,     snake_case_					:     List[Any]=0.02 ,     snake_case_					:     Tuple=0.1 ,     snake_case_					:     Any=1E-6 ,     snake_case_					:     Dict=64 ,     snake_case_					:     Tuple=10 ,     snake_case_					:     List[Any]=-1 ,     **snake_case_					:     Optional[Any] ,     ):
          super().__init__(**snake_case_						)

          snake_case__  :    Optional[Any]    						=      num_channels
          snake_case__  :    Dict    						=      num_encoder_blocks
          snake_case__  :    Tuple    						=      depths
          snake_case__  :    Union[str, Any]    						=      sr_ratios
          snake_case__  :    Tuple    						=      hidden_sizes
          snake_case__  :    Optional[Any]    						=      patch_sizes
          snake_case__  :    int    						=      strides
          snake_case__  :    List[Any]    						=      mlp_ratios
          snake_case__  :    Optional[int]    						=      num_attention_heads
          snake_case__  :    Dict    						=      hidden_act
          snake_case__  :    int    						=      hidden_dropout_prob
          snake_case__  :    Optional[Any]    						=      attention_probs_dropout_prob
          snake_case__  :    str    						=      initializer_range
          snake_case__  :    List[str]    						=      drop_path_rate
          snake_case__  :    int    						=      layer_norm_eps
          snake_case__  :    Tuple    						=      decoder_hidden_size
          snake_case__  :    List[Any]    						=      max_depth
          snake_case__  :    Dict    						=      head_in_index
