code: def test_compute_losses(art_warning):
      try:
          from art.estimators.object_detection.tensorflow_v2_faster_rcnn import (
              TensorFlowV2FasterRCNN,
          )
  
          # Get test data
          (_, _), (x_test, _), _, _ = load_dataset("cifar10")
          input_shape = tuple(x_test.shape[1:])
  
          frcnn = TensorFlowV2FasterRCNN(
              input_shape=input_shape,
              clip_values=(0, 255),
              attack_losses=(
                  "Loss/RPNLoss/localization_loss",
                  "Loss/RPNLoss/objectness_loss",
                  "Loss/BoxClassifierLoss/localization_loss",
                  "Loss/BoxClassifierLoss/classification_loss",
              ),
          )
  
          # Create labels
          result = frcnn.predict(x_test[:2])
  
          y = [
              {
                  "boxes": result[0]["boxes"],
                  "labels": result[0]["labels"],
                  "scores": np.ones_like(result[0]["labels"]),
              },
              {
                  "boxes": result[1]["boxes"],
                  "labels": result[1]["labels"],
                  "scores": np.ones_like(result[1]["labels"]),
              },
          ]
  
          # Compute losses
          losses = frcnn.compute_losses(x_test[:2], y)
  
          assert len(losses) == 4
  
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/estimators/object_detection/test_tensorflow_v2_faster_rcnn.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import numpy
  import pytest
  from art.utils import load_dataset
  from tests.utils import ARTTestException, master_seed
label_desc: Use image node_id 4 for calling a global function with example usage: test_compute_losses(art_warning) without return types