adversarial.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:foolbox 作者: bethgelab 项目源码 文件源码
def __is_adversarial(self, image, predictions):
        """Interface to criterion.is_adverarial that calls
        __new_adversarial if necessary.

        Parameters
        ----------
        predictions : :class:`numpy.ndarray`
            A vector with the pre-softmax predictions for some image.
        label : int
            The label of the unperturbed reference image.

        """
        is_adversarial = self.__criterion.is_adversarial(
            predictions, self.__original_class)
        if is_adversarial:
            is_best, distance = self.__new_adversarial(image)
        else:
            is_best = False
            distance = None
        assert isinstance(is_adversarial, bool) or \
            isinstance(is_adversarial, np.bool_)
        return is_adversarial, is_best, distance
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号