



import importlib.metadata
from typing import Union

from packaging.version import Version, parse

from .constants import STR_OPERATION_TO_FUNC


_lowercase						  =		parse(importlib.metadata.version("torch"))



def 		lowerCAmelCase__    (					UpperCamelCase_				:       Union[str, Version] ,       UpperCamelCase_				:       str ,       UpperCamelCase_				:       str	)->  List[str]:
    if operation not in STR_OPERATION_TO_FUNC.keys():
        raise ValueError(f"`operation` must be one of {list(STR_OPERATION_TO_FUNC.keys()	)}, received {operation}"	)
    A__		 =					STR_OPERATION_TO_FUNC[operation]
    if isinstance(UpperCamelCase_ ,       UpperCamelCase_	):
        A__		 =					parse(importlib.metadata.version(UpperCamelCase_	)	)
    return operation(UpperCamelCase_ ,       parse(UpperCamelCase_	)	)



def 		lowerCAmelCase__    (					UpperCamelCase_				:       str ,       UpperCamelCase_				:       str	)->  Tuple:
    return compare_versions(UpperCamelCase_ ,       UpperCamelCase_ ,       UpperCamelCase_	)





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


_lowercase						  =		logging.get_logger(__name__)



class     _UpperCAmelCase			(       A__     ):
     UpperCamelCase__		    =				'''timm_backbone'''




     def __init__(				self ,						a__=None ,						a__=3 ,						a__=True ,						a__=True ,						a__=None ,						**a__ ,						):
         super().__init__(**a__)
         A__		 =					backbone
         A__		 =					num_channels
         A__		 =					features_only
         A__		 =					use_pretrained_backbone
         A__		 =					True
         A__		 =					out_indices if out_indices is not None else (-1,)
