def _get_metrics(self, x: np.ndarray, batch_size: int = 128) -> np.ndarray:
        """
        Calculate similarities that combining label consistency and representation similarity for given samples

        :param x: Input samples
        :param batch_size: Batch size for processing
        :return: A report similarities
        """
        import torch
        import torch.nn.functional as F

        samples = torch.from_numpy(x).to(self.device)

        self.target_model.eval()
        self.backbone.eval()  # type: ignore
        self.model_classifier.eval()  # type: ignore
        self.projector.eval()  # type: ignore

        number_batch = int(math.ceil(len(samples) / batch_size))

        similarities_list = []

        with torch.no_grad():
            for index in range(number_batch):
                start = index * batch_size
                end = min((index + 1) * batch_size, len(samples))

                batch_samples = samples[start:end]
                b, c, h, w = batch_samples.shape

                trans_images = self._multi_transform(batch_samples).to(self.device)
                ssl_backbone_out = self.backbone(batch_samples)  # type: ignore

                ssl_repre = self.projector(ssl_backbone_out)  # type: ignore
                ssl_pred = self.model_classifier(ssl_backbone_out)  # type: ignore
                ssl_label = torch.max(ssl_pred, -1)[1]

                aug_backbone_out = self.backbone(trans_images.reshape(-1, c, h, w))  # type: ignore
                aug_repre = self.projector(aug_backbone_out)  # type: ignore
                aug_pred = self.model_classifier(aug_backbone_out)  # type: ignore
                aug_pred = aug_pred.reshape(b, self.aug_num, -1)

                sim_repre = F.cosine_similarity(
                    ssl_repre.unsqueeze(dim=1), aug_repre.reshape(b, self.aug_num, -1), dim=2
                )

                sim_preds = F.cosine_similarity(
                    F.one_hot(ssl_label, num_classes=ssl_pred.shape[-1]).unsqueeze(dim=1),
                    aug_pred,
                    dim=2,
                )

                similarities_list.append(
                    (self.alpha * sim_preds + (1 - self.alpha) * sim_repre).sort(descending=True)[0].cpu().numpy()
                )

        similarities = np.concatenate(similarities_list, axis=0)

        return similarities

        Calculate similarities that combining label consistency and representation similarity for given samples

        :param x: Input samples
        :param batch_size: Batch size for processing
        :return: A report similarities
        
art/defences/detector/evasion/beyond_detector.py