
'''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        UpperCAmelCase_ (  lowerCamelCase_      ,			lowerCamelCase_=None      ,			lowerCamelCase_=None      ,			lowerCamelCase_=None			):







 """simple docstring"""


 lowerCAmelCase__     :   Tuple     		=	True
 while ask_again:
  lowerCAmelCase__     :   Union[str, Any]     		=	input(lowerCamelCase_			)
  try:
   if default is not None and len(lowerCamelCase_			) == 0:
    return default
   return convert_value(lowerCamelCase_			) if convert_value is not None else result
  except Exception:
   if error_message is not None:
    print(lowerCamelCase_			)


def        UpperCAmelCase_ (  lowerCamelCase_      ,			lowerCamelCase_=[]      ,			lowerCamelCase_=None      ,			lowerCamelCase_=0			):







 """simple docstring"""


 lowerCAmelCase__     :   str     		=	BulletMenu(lowerCamelCase_      ,			lowerCamelCase_			)
 lowerCAmelCase__     :   Optional[Any]     		=	menu.run(default_choice=lowerCamelCase_			)
 return convert_value(lowerCamelCase_			) if convert_value is not None else result


def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__     :   str     		=	int(lowerCamelCase_			)
 return ComputeEnvironment(["LOCAL_MACHINE", "AMAZON_SAGEMAKER"][value]			)


def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__     :   int     		=	int(lowerCamelCase_			)
 return DistributedType(["NO", "MULTI_CPU", "MULTI_XPU", "MULTI_GPU", "MULTI_NPU", "TPU"][value]			)


def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__     :   Optional[Any]     		=	int(lowerCamelCase_			)
 return DynamoBackend(DYNAMO_BACKENDS[value]			).value


def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__     :   Tuple     		=	int(lowerCamelCase_			)
 return PrecisionType(["no", "fp16", "bf16", "fp8"][value]			)


def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__     :   List[Any]     		=	int(lowerCamelCase_			)
 return SageMakerDistributedType(["NO", "DATA_PARALLEL", "MODEL_PARALLEL"][value]			)


def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


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







class    lowerCAmelCase       (     argparse.RawDescriptionHelpFormatter  ):


 def    _A	(    self  : List[Any]			,							a__  : Optional[Any]			,							a__  : int			,							a__  : Dict			,							a__  : int    ):
  '''simple docstring'''

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







'''simple docstring'''

from cva import destroyAllWindows, imread, imshow, waitKey


def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__		,     lowerCAmelCase__     :   Tuple     		=	img.shape[0], img.shape[1]

 # converting each pixel's color to its negative
 for i in range(lowerCamelCase_			):
  for j in range(lowerCamelCase_			):
   lowerCAmelCase__     :   Optional[int]     		=	[2_5_5, 2_5_5, 2_5_5] - img[i][j]

 return img


if __name__ == "__main__":
     # read original image
     snake_case									=    imread("""image_data/lena.jpg""", 1)

     # convert to its negative
     snake_case									=    convert_to_negative(img)

     # show result image
     imshow("""negative of original image""", img)
     waitKey(0)
     destroyAllWindows()





