code: 
  
  
  
  '''simple docstring'''
  
  
  
  
  
  from collections import OrderedDict
  from dataclasses import fields
  from typing import Any, Tuple
  
  import numpy as np
  
  from .import_utils import is_torch_available
  
  
  
  
  def     UpperCAmelCase__ (							__snake_case							)   -> List[Any]:
    if is_torch_available():
      import torch
  
      if isinstance(__snake_case						,				torch.Tensor							):
        return True
  
    return isinstance(__snake_case						,				np.ndarray							)
  
  
  
  class 		_snake_case      (			lowerCAmelCase_				):
  
  
  
  
  
   """simple docstring"""
  
  
  
   def lowercase_		(						self					)	->							Optional[int]:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     _A           =    fields(self					)
  
     # Safety and consistency checks
     if not len(__SCREAMING_SNAKE_CASE					):
       raise ValueError(f'''{self.__class__.__name__} has no fields.'''					)
  
     _A           =    getattr(self	,    class_fields[0].name					)
     _A           =    all(getattr(self	,    field.name					) is None for field in class_fields[1:]					)
  
     if other_fields_are_none and isinstance(__SCREAMING_SNAKE_CASE	,    __SCREAMING_SNAKE_CASE					):
       for key, value in first_field.items():
         _A           =    value
     else:
       for field in class_fields:
         _A           =    getattr(self	,    field.name					)
         if v is not None:
           _A           =    v
   def __delitem__(						self	,    *a	,    **a					)	->							Any:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     raise Exception(f'''You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.'''					)
   def lowercase_		(						self	,    *a	,    **a					)	->							List[str]:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     raise Exception(f'''You cannot use ``setdefault`` on a {self.__class__.__name__} instance.'''					)
   def lowercase_		(						self	,    *a	,    **a					)	->							Optional[Any]:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     raise Exception(f'''You cannot use ``pop`` on a {self.__class__.__name__} instance.'''					)
   def lowercase_		(						self	,    *a	,    **a					)	->							Tuple:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     raise Exception(f'''You cannot use ``update`` on a {self.__class__.__name__} instance.'''					)
   def __getitem__(						self	,    a					)	->							Union[str, Any]:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     if isinstance(__SCREAMING_SNAKE_CASE	,    __SCREAMING_SNAKE_CASE					):
       _A           =    dict(self.items()					)
       return inner_dict[k]
     else:
       return self.to_tuple()[k]
   def __setattr__(						self	,    a	,    a					)	->							Optional[Any]:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     if name in self.keys() and value is not None:
       # Don't call self.__setitem__ to avoid recursion errors
       super().__setitem__(__SCREAMING_SNAKE_CASE	,    __SCREAMING_SNAKE_CASE					)
     super().__setattr__(__SCREAMING_SNAKE_CASE	,    __SCREAMING_SNAKE_CASE					)
   def __setitem__(						self	,    a	,    a					)	->							Any:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     super().__setitem__(__SCREAMING_SNAKE_CASE	,    __SCREAMING_SNAKE_CASE					)
     # Don't call self.__setattr__ to avoid recursion errors
     super().__setattr__(__SCREAMING_SNAKE_CASE	,    __SCREAMING_SNAKE_CASE					)
  
  
  
   def lowercase_		(						self					)	->							List[Any]:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     return tuple(self[k] for k in self.keys()					)
style_context: 
  
  
  
  from ..utils import requires_backends
  
  
  __lowerCamelCase  				=					None
  
  
  
  class 		_snake_case      :
  
  
  
  
  
   """simple docstring"""
  
  
  
   def __init__(						self	,    *a	,    **a					)	->							Tuple:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     requires_backends(self	,    ['''detectron2''']					)
  
  
  
   @classmethod
   def lowercase_		(						cls	,    *a	,    **a					)	->							Optional[int]:
  
  
  
  
     """simple docstring"""
  
  
  
  
  
  
  
     requires_backends(cls	,    ['''detectron2''']					)