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   ):
  
  
  
  
     '''simple docstring'''
  
     if is_torch_available():
        import torch
  
        if isinstance(snake_case	,     torch.Tensor   ):
           return True
  
     return isinstance(snake_case	,     np.ndarray   )
  
  
  
  
  
  
  
  class 						lowercase     (   UpperCAmelCase_):
  
  
  
  
  
  
        def    A__(self					)       ->   List[Any]:
           SCREAMING_SNAKE_CASE__			:				int       						= fields(self					)
  
           # Safety and consistency checks
           if not len(a__					):
              raise ValueError(f"""{self.__class__.__name__} has no fields."""					)
  
           SCREAMING_SNAKE_CASE__			:				Dict       						= getattr(self ,  class_fields[0].name					)
           SCREAMING_SNAKE_CASE__			:				Dict       						= all(getattr(self ,  field.name					) is None for field in class_fields[1:]					)
  
           if other_fields_are_none and isinstance(a__ ,  a__					):
              for key, value in first_field.items():
                 SCREAMING_SNAKE_CASE__			:				Tuple       						= value
           else:
              for field in class_fields:
                 SCREAMING_SNAKE_CASE__			:				Optional[int]       						= getattr(self ,  field.name					)
                 if v is not None:
                    SCREAMING_SNAKE_CASE__			:				Tuple       						= v
  
  
  
  
  
  
        def __delitem__(self ,  *a__ ,  **a__					)       ->   Tuple:
           raise Exception(f"""You cannot use ``__delitem__`` on a {self.__class__.__name__} instance."""					)
  
  
  
  
  
  
        def    A__(self ,  *a__ ,  **a__					)       ->   List[Any]:
           raise Exception(f"""You cannot use ``setdefault`` on a {self.__class__.__name__} instance."""					)
  
  
  
  
  
  
        def    A__(self ,  *a__ ,  **a__					)       ->   Union[str, Any]:
           raise Exception(f"""You cannot use ``pop`` on a {self.__class__.__name__} instance."""					)
  
  
  
  
  
  
        def    A__(self ,  *a__ ,  **a__					)       ->   List[Any]:
           raise Exception(f"""You cannot use ``update`` on a {self.__class__.__name__} instance."""					)
  
  
  
  
  
  
        def __getitem__(self ,  a__					)       ->   List[Any]:
           if isinstance(a__ ,  a__					):
              SCREAMING_SNAKE_CASE__			:				List[Any]       						= dict(self.items()					)
              return inner_dict[k]
           else:
              return self.to_tuple()[k]
  
  
  
  
  
  
        def __setattr__(self ,  a__ ,  a__					)       ->   List[str]:
           if name in self.keys() and value is not None:
              # Don't call self.__setitem__ to avoid recursion errors
              super().__setitem__(a__ ,  a__					)
           super().__setattr__(a__ ,  a__					)
  
  
  
  
  
  
        def __setitem__(self ,  a__ ,  a__					)       ->   Any:
           # Will raise a KeyException if needed
           super().__setitem__(a__ ,  a__					)
           # Don't call self.__setattr__ to avoid recursion errors
           super().__setattr__(a__ ,  a__					)
  
  
  
  
  
  
        def    A__(self					)       ->   Tuple[Any]:
           return tuple(self[k] for k in self.keys()					)
  
  
style_context: 
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  # Copyright 2023 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.
  from typing import TYPE_CHECKING
  
  # rely on isort to merge the imports
  from ...utils import (
      OptionalDependencyNotAvailable,
      _LazyModule,
      is_torch_available,
  )
  
  
  lowercase__			=	{
      '''configuration_convnextv2''': [
          '''CONVNEXTV2_PRETRAINED_CONFIG_ARCHIVE_MAP''',
          '''ConvNextV2Config''',
      ]
  }
  
  try:
         if not is_torch_available():
                raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
         pass
  else:
         lowercase__			=	[
             '''CONVNEXTV2_PRETRAINED_MODEL_ARCHIVE_LIST''',
             '''ConvNextV2ForImageClassification''',
             '''ConvNextV2Model''',
             '''ConvNextV2PreTrainedModel''',
             '''ConvNextV2Backbone''',
         ]
  
  
  if TYPE_CHECKING:
         from .configuration_convnextva import (
             CONVNEXTV2_PRETRAINED_CONFIG_ARCHIVE_MAP,
             ConvNextVaConfig,
         )
  
         try:
                if not is_torch_available():
                       raise OptionalDependencyNotAvailable()
         except OptionalDependencyNotAvailable:
                pass
         else:
                from .modeling_convnextva import (
                    CONVNEXTV2_PRETRAINED_MODEL_ARCHIVE_LIST,
                    ConvNextVaBackbone,
                    ConvNextVaForImageClassification,
                    ConvNextVaModel,
                    ConvNextVaPreTrainedModel,
                )
  
  else:
         import sys
  
         lowercase__			=	_LazyModule(__name__, globals()['''__file__'''], _import_structure)
  
  