code: def get_loss(frcnn, x, y):
      frcnn._model.train()
      transform = torchvision.transforms.Compose(
          [torchvision.transforms.ToTensor()]
      )
      image_tensor_list = list()
  
      for i in range(x.shape[0]):
          if frcnn.clip_values is not None:
              img = transform(x[i] / frcnn.clip_values[1]).to(
                  frcnn._device
              )
          else:
              img = transform(x[i]).to(frcnn._device)
          image_tensor_list.append(img)
  
      loss = frcnn._model(image_tensor_list, y)
      for loss_type in [
          "loss_classifier",
          "loss_box_reg",
          "loss_objectness",
          "loss_rpn_box_reg",
      ]:
          loss[loss_type] = (
              loss[loss_type].cpu().detach().numpy().item()
          )
      return loss
  
file_path: adversarial-robustness-toolbox/examples/get_started_fasterrcnn.py
imports: import os
  import cv2
  import numpy
  import matplotlib.pyplot
  import torch
  import torchvision
  import argparse
  import json
  import yaml
  import pprint
  from art.estimators.object_detection import PyTorchFasterRCNN
  from art.attacks.evasion import RobustDPatch
label_desc: Use image node_id 3 for calling a global function with example usage: get_loss(frcnn, x, y) and returns: loss