From 4b41a52a3aaf5660895e2101c0a407a69a4f4021 Mon Sep 17 00:00:00 2001 From: jin-xiulang Date: Tue, 30 Mar 2021 09:44:49 +0800 Subject: [PATCH] Fix several issues of python-api --- mindarmour/adv_robustness/evaluations/attack_evaluation.py | 10 +++++----- mindarmour/adv_robustness/evaluations/defense_evaluation.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mindarmour/adv_robustness/evaluations/attack_evaluation.py b/mindarmour/adv_robustness/evaluations/attack_evaluation.py index 48e3914..aafb34c 100644 --- a/mindarmour/adv_robustness/evaluations/attack_evaluation.py +++ b/mindarmour/adv_robustness/evaluations/attack_evaluation.py @@ -136,10 +136,10 @@ class AttackEvaluate: - float, return average l0, l2, or linf distance of all success adversarial examples, return value includes following cases. - - If return value :math:`>=` 0, average lp distance. The lower, + - If return value :math:`>=` 0, average lp distance. The lower, the more successful the attack is. - - If return value is -1, there is no success adversarial examples. + - If return value is -1, there is no success adversarial examples. """ idxes = self._success_idxes success_num = idxes.shape[0] @@ -164,10 +164,10 @@ class AttackEvaluate: Returns: - float, average structural similarity. - - If return value ranges between (0, 1), the higher, the more - successful the attack is. + - If return value ranges between (0, 1), the higher, the more + successful the attack is. - - If return value is -1: there is no success adversarial examples. + - If return value is -1: there is no success adversarial examples. """ success_num = self._success_idxes.shape[0] if success_num == 0: diff --git a/mindarmour/adv_robustness/evaluations/defense_evaluation.py b/mindarmour/adv_robustness/evaluations/defense_evaluation.py index 27f6a66..8f783ef 100644 --- a/mindarmour/adv_robustness/evaluations/defense_evaluation.py +++ b/mindarmour/adv_robustness/evaluations/defense_evaluation.py @@ -106,7 +106,7 @@ class DefenseEvaluate: Returns: - float, the lower, the more successful the defense is. - - If return value == -1, len(idxes) == 0. + - If return value == -1, len(idxes) == 0. """ idxes = np.arange(self._num_samples) cond1 = np.argmax(self._def_preds, axis=1) == self._true_labels