def compute_loss(self, x: np.ndarray, y: np.ndarray, **kwargs) -> np.ndarray:
        """
        Compute the loss.

        :param x: Sample input with shape as expected by the model.
        :param y: Target values (class labels) one-hot-encoded of shape `(nb_samples, nb_classes)` or indices
                  of shape `(nb_samples,)`.
        :return: Array of losses of the same shape as `x`.
        """
        # Apply preprocessing
        x_preprocessed, _ = self._apply_preprocessing(x, y=None, fit=False)

        # Get the losses graph
        if not hasattr(self, "_loss_total"):
            loss = None
            for loss_name in self.attack_losses:
                if loss is None:
                    loss = self._losses[loss_name]
                else:
                    loss = loss + self._losses[loss_name]
            self._loss_total = loss

        # Create feed_dict
        feed_dict = {self.images: x_preprocessed}

        for placeholder, value in zip(self._groundtruth_boxes_list, y):
            feed_dict[placeholder] = value["boxes"]

        for placeholder, value in zip(self._groundtruth_classes_list, y):
            feed_dict[placeholder] = value["labels"]

        for placeholder, value in zip(self._groundtruth_weights_list, y):
            feed_dict[placeholder] = value["scores"]

        loss_values = self._sess.run(self._loss_total, feed_dict=feed_dict)

        return loss_values

        Compute the loss.

        :param x: Sample input with shape as expected by the model.
        :param y: Target values (class labels) one-hot-encoded of shape `(nb_samples, nb_classes)` or indices
                  of shape `(nb_samples,)`.
        :return: Array of losses of the same shape as `x`.
        
art/estimators/object_detection/tensorflow_faster_rcnn.py