I've been given a fully trained model by another researcher that has inputs as placeholders. Regarding it as a function f(x)
, I would like to find x
to minimize my distance metric (loss function) dist(x, f(x))
. This could be something like the euclidean distance between the two points.
I tried to use TensorFlow's built-in optimizer functions. The issue is that tf.train.AdamOptimizer(1e-4).minimize(loss, var_list[input_placeholder])
fails, complaining that input_placeholder
isn't of a supported type. Thus, I cannot get gradients for my input.
How can I optimize a function in TensorFlow when the inputs have to be specified in this way? Unfortunately, these placeholders are not passed through a Variable
first, and I have to treat that model as a black box.