class_docstr: Base class for all model outputs as dataclass. Has a `__getitem__` that allows indexing by integer or slice (like a
  tuple) or strings (like a dictionary) that will ignore the `None` attributes. Otherwise behaves like a regular
  python dictionary.
  
  <Tip warning={true}>
  
  You can't unpack a `ModelOutput` directly. Use the [`~utils.ModelOutput.to_tuple`] method to convert it to a tuple
  before.
  
  </Tip>
class_docstr_tok: ["Base","class","for","all","model","outputs","as","dataclass",".","Has","a","`","__getitem__","`","that","allows","indexing","by","integer","or","slice","(","like","a","tuple",")","or","strings","(","like","a","dictionary",")","that","will","ignore","the","`","None","`","attributes",".","Otherwise","behaves","like","a","regular","python","dictionary",".","<","Tip","warning=","{","true","}",">","You","ca","n't","unpack","a","`","ModelOutput","`","directly",".","Use","the","[","`","~utils.ModelOutput.to_tuple","`","]","method","to","convert","it","to","a","tuple","before",".","<","\/Tip",">"]
code: def __init__(self, *args, **kwargs):
      super().__init__(*args, **kwargs)
  
      # Subclasses of ModelOutput must use the @dataclass decorator
      # This check is done in __init__ because the @dataclass decorator operates after __init_subclass__
      # issubclass() would return True for issubclass(ModelOutput, ModelOutput) when False is needed
      # Just need to check that the current class is not ModelOutput
      is_modeloutput_subclass = self.__class__ != ModelOutput
  
      if is_modeloutput_subclass and not is_dataclass(self):
          raise TypeError(
              f"{self.__module__}.{self.__class__.__name__} is not a dataclasss."
              " This is a subclass of ModelOutput and so must use the @dataclass decorator."
          )
  
imports: import inspect
  import tempfile
  from collections import OrderedDict, UserDict
  from collections.abc import MutableMapping
  from contextlib import ExitStack, contextmanager
  from dataclasses import fields, is_dataclass
  from enum import Enum
  from typing import Any, ContextManager, Iterable, List, Tuple
  import numpy
  from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy
label_desc: Use image node_id 2 to create a new ModelOutput object from inherited base classes: OrderedDict with example: obj = ModelOutput()