def compute_loss_from_predictions(self, pred: np.ndarray, y: np.ndarray, **kwargs) -> np.ndarray:
        """
        Compute the loss of the regressor for predictions `pred`. If loss_fn not provided at init, MSE loss is computed.

        :param pred: Model predictions.
        :param y: Target values.
        :return: Loss values.
        """
        if self._loss_fn:
            return self._loss_fn(y, pred)
        # default MSE loss
        return (y - pred) ** 2

        Compute the loss of the regressor for predictions `pred`. If loss_fn not provided at init, MSE loss is computed.

        :param pred: Model predictions.
        :param y: Target values.
        :return: Loss values.
        
art/estimators/regression/blackbox.py