def get_accuracy(preds: np.ndarray | "torch.Tensor", labels: np.ndarray | "torch.Tensor") -> np.ndarray:
        """
        Helper function to get the accuracy during training.

        :param preds: model predictions.
        :param labels: ground truth labels (not one hot).
        :return: prediction accuracy.
        """
        if not isinstance(preds, np.ndarray):
            preds = preds.detach().cpu().numpy()

        if not isinstance(labels, np.ndarray):
            labels = labels.detach().cpu().numpy()

        return np.sum(np.argmax(preds, axis=1) == labels) / len(labels)

        Helper function to get the accuracy during training.

        :param preds: model predictions.
        :param labels: ground truth labels (not one hot).
        :return: prediction accuracy.
        
art/estimators/certification/derandomized_smoothing/pytorch.py