def _loss(
        self,
        videos: "torch.Tensor",
        target: list[dict[str, "torch.Tensor"]],
        y_init: "torch.Tensor",
        foreground: "torch.Tensor" | None,
        patch_points: np.ndarray | None,
    ) -> "torch.Tensor":
        """
        Calculate L1-loss.

        :param videos: Video samples.
        :param target: Target labels/boxes.
        :param y_init: Initial labels/boxes.
        :param foreground: Foreground mask.
        :param patch_points: Array of shape (nb_frames, 4, 2) containing four pairs of integers (height, width)
                             corresponding to the coordinates of the four corners top-left, top-right, bottom-right,
                             bottom-left of the transformed image in the coordinate-system of the original image.
        :return: Loss.
        """
        import torch

        y_pred = self._predictions(videos, y_init, foreground, patch_points)
        loss = torch.nn.L1Loss(reduction="sum")(y_pred[0]["boxes"].float(), target[0]["boxes"].float())
        for i in range(1, len(y_pred)):
            loss = loss + torch.nn.L1Loss(reduction="sum")(y_pred[i]["boxes"].float(), target[i]["boxes"].float())

        return loss

        Calculate L1-loss.

        :param videos: Video samples.
        :param target: Target labels/boxes.
        :param y_init: Initial labels/boxes.
        :param foreground: Foreground mask.
        :param patch_points: Array of shape (nb_frames, 4, 2) containing four pairs of integers (height, width)
                             corresponding to the coordinates of the four corners top-left, top-right, bottom-right,
                             bottom-left of the transformed image in the coordinate-system of the original image.
        :return: Loss.
        
art/attacks/evasion/adversarial_texture/adversarial_texture_pytorch.py