import tensorflow as tf

    np.savetxt(FLAGS.attack_method + '_' + FLAGS.dataset + '/tSNE/tSNEisadv_' + f1, is_adv_all)
    return None

def tSNE_visual_carliniLi(hps, num_batch):
    # Construct graph
    images, labels = input_name.build_input(
        FLAGS.dataset, FLAGS.eval_data_path, hps.batch_size, FLAGS.mode)  # FLAGS.mode='attack', batch_size=200
    Res = model_name.ResNet(hps, images, FLAGS.mode, Reuse=False)
    Res.build_graph()
    saver = tf.train.Saver()
    # Open session and restore checkpoint
    sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
    tf.train.start_queue_runners(sess)
    sess.run(tf.global_variables_initializer())

    ckpt_state = tf.train.get_checkpoint_state(FLAGS.log_root)  # Choose dir according to rt
    tf.logging.info('Loading checkpoint %s', ckpt_state.model_checkpoint_path)
    saver.restore(sess, ckpt_state.model_checkpoint_path)

    model_carlini = models_carlini(hps)
    if FLAGS.attack_method == 'carliniLi':
        attack_carlini = attacks.carliniLi.CarliniLi(sess, model_carlini, largest_const=10 ** -3)
    elif FLAGS.attack_method == 'carliniL2':
        attack_carlini = attacks.carliniL2.CarliniL2(sess, model_carlini, batch_size=10, max_iterations=1000, confidence=0,binary_search_steps=3)
    adv_image = tf.placeholder(tf.float32, shape=[hps.batch_size, image_size, image_size, num_channel])

    _, logits_nor = model_carlini.predict(images, tsne_logits=True)
    _, logits_adv = model_carlini.predict(adv_image, tsne_logits=True)

    dim_logits = logits_nor.shape[1]
