xi_op = tf.placeholder(dtype=tf.float32, shape=dims)
// Using model predictions as ground truth to avoid label leaking
preds_max = tf.reduce_max(self.model(xi_op), 1, keep_dims=True)
y = tf.to_float(tf.equal(self.model(xi_op), preds_max))
y = y / tf.reduce_sum(y, 1, keep_dims=True)
// Compute loss
loss = model_loss(y, self.model(xi_op), mean=False)
grad_xi, = tf.gradients(loss, xi_op)