idxs = [np.where(np.argmax(Y_test,axis=1)==i)[0][0] for i in range(10)]
adv_inputs = np.array([[x]*10 for x in X_test[idxs]], dtype=np.float32).reshape((100,28,28,1))
adv_ys = np.array([onehot(range(10),10) for x in range(10)], dtype=np.float32).reshape((100,10))
adv = sess.run(cw.generate(tf.constant(adv_inputs), tf.constant(adv_ys), **cw_params))
After Change
// Check if we are using a GPU, and generate higher quality attacks if we are
try:
with tf.device("/gpu:0"):
sess.run(tf.constant(1))
gpu = True
except: