


"""simple docstring"""



# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse

from ...utils.dataclasses import (
    ComputeEnvironment,
    DistributedType,
    DynamoBackend,
    PrecisionType,
    SageMakerDistributedType,
)
from ..menu import BulletMenu


__snake_case             =   [
    """EAGER""",
    """AOT_EAGER""",
    """INDUCTOR""",
    """NVFUSER""",
    """AOT_NVFUSER""",
    """AOT_CUDAGRAPHS""",
    """OFI""",
    """FX2TRT""",
    """ONNXRT""",
    """IPEX""",
]







def   __lowerCAmelCase						(						lowercase  :  Any						,							lowercase  :  str=None						,							lowercase  :  str=None						,							lowercase  :  str=None			)     ->						Union[str, Any]:


    """simple docstring"""





    snake_case   :				str				 =   True
    while ask_again:
        snake_case   :				str				 =   input(lowercase			)
        try:
            if default is not None and len(lowercase			) == 0:
                return default
            return convert_value(lowercase			) if convert_value is not None else result
        except Exception:
            if error_message is not None:
                print(lowercase			)







def   __lowerCAmelCase						(						lowercase  :  Tuple						,							lowercase  :  Any=[]						,							lowercase  :  Dict=None						,							lowercase  :  str=0			)     ->						Any:


    """simple docstring"""





    snake_case   :				str				 =   BulletMenu(lowercase						,							lowercase			)
    snake_case   :				Any				 =   menu.run(default_choice=lowercase			)
    return convert_value(lowercase			) if convert_value is not None else result







def   __lowerCAmelCase						(						lowercase  :  Dict			)     ->						Tuple:


    """simple docstring"""





    snake_case   :				Optional[Any]				 =   int(lowercase			)
    return ComputeEnvironment(["LOCAL_MACHINE", "AMAZON_SAGEMAKER"][value]			)







def   __lowerCAmelCase						(						lowercase  :  Any			)     ->						Union[str, Any]:


    """simple docstring"""





    snake_case   :				Tuple				 =   int(lowercase			)
    return DistributedType(["NO", "MULTI_CPU", "MULTI_XPU", "MULTI_GPU", "MULTI_NPU", "TPU"][value]			)







def   __lowerCAmelCase						(						lowercase  :  str			)     ->						List[Any]:


    """simple docstring"""





    snake_case   :				Union[str, Any]				 =   int(lowercase			)
    return DynamoBackend(DYNAMO_BACKENDS[value]			).value







def   __lowerCAmelCase						(						lowercase  :  List[str]			)     ->						List[Any]:


    """simple docstring"""





    snake_case   :				List[str]				 =   int(lowercase			)
    return PrecisionType(["no", "fp16", "bf16", "fp8"][value]			)







def   __lowerCAmelCase						(						lowercase  :  Dict			)     ->						Optional[Any]:


    """simple docstring"""





    snake_case   :				Optional[int]				 =   int(lowercase			)
    return SageMakerDistributedType(["NO", "DATA_PARALLEL", "MODEL_PARALLEL"][value]			)







def   __lowerCAmelCase						(						lowercase  :  Any			)     ->						Dict:


    """simple docstring"""





    return {"yes": True, "no": False}[value.lower()]







class _lowerCAmelCase    (				argparse.RawDescriptionHelpFormatter     ):







   def 			lowerCamelCase		(     self						,     UpperCamelCase__						,     UpperCamelCase__						,     UpperCamelCase__						,     UpperCamelCase__						)     ->		int:

       '''simple docstring'''




       snake_case   :				int				 =   super()._format_usage(UpperCamelCase__						,     UpperCamelCase__						,     UpperCamelCase__						,     UpperCamelCase__						)
       snake_case   :				Union[str, Any]				 =   usage.replace("<command> [<args>] "						,     ""						)
       return usage









"""simple docstring"""



from __future__ import annotations

import numpy as np







def   __lowerCAmelCase						(						lowercase  :  list[float]			)     ->						Any:


    """simple docstring"""





    return np.maximum(0						,							lowercase			)


if __name__ == "__main__":
  print(np.array(relu([-1, 0, 5])))  # --> [0, 0, 5]





