def compute_loss(self, x: np.ndarray, y: list[dict[str, np.ndarray | "torch.Tensor"]], **kwargs) -> np.ndarray:
        """
        Compute loss.

        :param x: Samples of shape (nb_samples, nb_frames, height, width, nb_channels).
        :param y: Target values of format `list[dict[str, np.ndarray]]`, one dictionary for each input image. The keys
                  of the dictionary are:

                  - boxes [N_FRAMES, 4]: the boxes in [x1, y1, x2, y2] format, with 0 <= x1 < x2 <= W and
                                         0 <= y1 < y2 <= H.
        :return: Total loss.
        """
        import torch

        output_dict, _, _ = self._get_losses(x=x, y=y)

        if isinstance(output_dict["torch.nn.L1Loss"], list):
            output_list = []
            for out in output_dict["torch.nn.L1Loss"]:
                output_list.append(out.detach().cpu().numpy())
            output = np.array(output_list)
        elif isinstance(output_dict["torch.nn.L1Loss"], torch.Tensor):
            output = output_dict["torch.nn.L1Loss"].detach().cpu().numpy()
        else:
            output = np.array(output_dict["torch.nn.L1Loss"])

        return output

        Compute loss.

        :param x: Samples of shape (nb_samples, nb_frames, height, width, nb_channels).
        :param y: Target values of format `list[dict[str, np.ndarray]]`, one dictionary for each input image. The keys
                  of the dictionary are:

                  - boxes [N_FRAMES, 4]: the boxes in [x1, y1, x2, y2] format, with 0 <= x1 < x2 <= W and
                                         0 <= y1 < y2 <= H.
        :return: Total loss.
        
art/estimators/object_tracking/pytorch_goturn.py