import tensorflow as tf

#DeepFool 仅实现了目标攻击
def deepfool(x,
        loss=None,
        bounds=(0,1)):

    (clip_min, clip_max)=bounds

    grad, = tf.gradients(loss, x)

    r=old_div(grad*loss,tf.reduce_sum(tf.square(grad)))

    #目标是让loss下降
    adv_x = x - r

