class_docstr: This class implements a model-specific object detector using DEtection TRansformer (DETR)
  and PyTorch following the input and output formats of torchvision.
class_docstr_tok: ["This","class","implements","a","model-specific","object","detector","using","DEtection","TRansformer","(","DETR",")","and","PyTorch","following","the","input","and","output","formats","of","torchvision","."]
docstr: Compute the loss of the neural network for samples `x`.
  
  :param x: Samples of shape (nb_samples, nb_features) or (nb_samples, nb_pixels_1, nb_pixels_2,
            nb_channels) or (nb_samples, nb_channels, nb_pixels_1, nb_pixels_2).
  :param y: Target values of format `List[Dict[Tensor]]`, one for each input image. The
            fields of the Dict are as follows:
  
            - boxes (FloatTensor[N, 4]): the predicted boxes in [x1, y1, x2, y2] format, with values                     between 0 and H and 0 and W
            - labels (Int64Tensor[N]): the predicted labels for each image
            - scores (Tensor[N]): the scores or each prediction.
  :return: Loss.
docstr_tok: ["Compute","the","loss","of","the","neural","network","for","samples","`","x","`",".",":","param","x",":","Samples","of","shape","(","nb_samples",",","nb_features",")","or","(","nb_samples",",","nb_pixels_1",",","nb_pixels_2",",","nb_channels",")","or","(","nb_samples",",","nb_channels",",","nb_pixels_1",",","nb_pixels_2",")",".",":","param","y",":","Target","values","of","format","`","List","[","Dict","[","Tensor","]","]","`",",","one","for","each","input","image",".","The","fields","of","the","Dict","are","as","follows",":","-","boxes","(","FloatTensor","[","N",",","4","]",")",":","the","predicted","boxes","in","[","x1",",","y1",",","x2",",","y2","]","format",",","with","values","between","0","and","H","and","0","and","W","-","labels","(","Int64Tensor","[","N","]",")",":","the","predicted","labels","for","each","image","-","scores","(","Tensor","[","N","]",")",":","the","scores","or","each","prediction",".",":","return",":","Loss","."]
code: def compute_loss(  # type: ignore
      self,
      x: Union[np.ndarray, "torch.Tensor"],
      y: List[Dict[str, Union[np.ndarray, "torch.Tensor"]]],
      **kwargs,
  ) -> Union[np.ndarray, "torch.Tensor"]:
      """
          Compute the loss of the neural network for samples `x`.
  
          :param x: Samples of shape (nb_samples, nb_features) or (nb_samples, nb_pixels_1, nb_pixels_2,
                    nb_channels) or (nb_samples, nb_channels, nb_pixels_1, nb_pixels_2).
          :param y: Target values of format `List[Dict[Tensor]]`, one for each input image. The
                    fields of the Dict are as follows:
  
                    - boxes (FloatTensor[N, 4]): the predicted boxes in [x1, y1, x2, y2] format, with values \
                      between 0 and H and 0 and W
                    - labels (Int64Tensor[N]): the predicted labels for each image
                    - scores (Tensor[N]): the scores or each prediction.
          :return: Loss.
          """
      import torch
  
      x, y = self._apply_resizing(x, y)
      output, _, _ = self._get_losses(x=x, y=y)
  
      loss = None
      for loss_name in self.attack_losses:
          if loss is None:
              loss = output[loss_name]
          else:
              loss = loss + output[loss_name]
      assert loss is not None
  
      if isinstance(x, torch.Tensor):
          return loss
  
      return loss.detach().cpu().numpy()
  
file_path: adversarial-robustness-toolbox/art/estimators/object_detection/pytorch_detection_transformer.py
imports: import logging
  from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union, Any
  import numpy
  from art.estimators.object_detection.object_detector import ObjectDetectorMixin
  from art.estimators.pytorch import PyTorchEstimator
label_desc: Use image node_id 11 for calling the PyTorchDetectionTransformer obj's underlying member method code with example usage: obj.compute_loss(x, y) and returns: loss, loss