Am I correct that in Tensorflow, when I run
anything, my feed_dict
needs to give values to all my placeholders, even ones that are irrelevant to what I'm running?
In particular I'm thinking of making a prediction, in which case my targets
placeholder is irrelevant.
Well, it depends on how your computation graph looks like and how you run the ops which are fed by tensors (here:
placeholders
). If there's no dependency on the placeholder in any part of the computation graph that you'll execute in the session, then it does not need to be fed a value. Here's a small example:On the other hand, if you execute a part of the computation graph which has a dependency on the placeholder then a value it must be fed else it will raise
InvalidArgumentError
. Here's an example demonstrating this:Executing the above code, throws the following
InvalidArgumentError
So, to make it work, you've to feed the placeholder using
feed_dict
as in: