class_docstr: Module to be used for object detection purposes.
  
  The module subclasses :py:class:`~kornia.x.Trainer` and overrides the
  :py:func:`~kornia.x.Trainer.evaluate` function implementing IoU :py:func:`~kornia.metrics.mean_iou`.
  
  .. seealso::
      Learn how to use this class in the following
      `example <https://github.com/kornia/tutorials/tree/master/scripts/training/object_detection/>`__.
class_docstr_tok: ["Module","to","be","used","for","object","detection","purposes",".","The","module","subclasses",":","py",":","class",":","`","~kornia.x.Trainer","`","and","overrides","the",":","py",":","func",":","`","~kornia.x.Trainer.evaluate","`","function","implementing","IoU",":","py",":","func",":","`","~kornia.metrics.mean_iou","`",".","..","seealso",":",":","Learn","how","to","use","this","class","in","the","following","`","example","<","https",":","\/\/github.com\/kornia\/tutorials\/tree\/master\/scripts\/training\/object_detection\/",">","`","__","."]
code: def compute_loss(self, *args: Tensor) -> Tensor:
      if self.loss_computed_by_model:
          # Note: in case of dict losses obtained
          if isinstance(args[0], dict):
              return stack([v for _, v in args[0].items()]).mean()
          return stack(list(args[0])).sum()
      if self.criterion is None:
          raise RuntimeError(
              "`criterion` should not be None if `loss_computed_by_model` is False."
          )
      return self.criterion(*args)
  
file_path: kornia/kornia/x/trainers.py
imports: from typing import Any, Callable, Dict, Optional, Tuple
  from torch.optim import Optimizer, lr_scheduler
  from torch.utils.data import DataLoader
  from kornia.core import Module, Tensor, stack
  from kornia.metrics import accuracy, mean_average_precision, mean_iou
  from .trainer import Trainer
  from .utils import Configuration
label_desc: Use image node_id 3 for calling the ObjectDetectionTrainer obj's underlying member method code with example usage: obj.compute_loss() and returns: self, stack, stack