0

I have an Some autoencoder. The model is not important now. Suppose that this model takes as input some image and output the reconstructed image. After training, I would like to see the effect of one tensor on the output. In addition, images are being fed into the autoencoder through a FIFOQueue. Therefore, when running the following peace of code:

reconstructed_image = sess.run([deconv_image], feed_dict={mu:my_vector})

where deconv_image is the output tensor of the model and mu is a hidden tensor inside the model; will automatically feed the model with an image from the Queue.

My question is: would the value inside mu be replaced by whatever should come from the input image, or, it takes the vector that I fed using the feed_dict argument.

Any help is much appreciated!!

I. A
  • 2,252
  • 26
  • 65

1 Answers1

0

When running the final tensor, that is, evaluating the last tensor of a graph, it will run all tensors which it depends on. So if we have y3 operation which depends on y2 and y2 depends on y1, then, running the final tensor in the graph will cause y1 to be run first, then y2 is evaluated after it gets its input from y1 and finally, the output of y2 will feed into y3. This graph could be as follows: y1 -> y2 -> y3

On the other hand, I can run (evaluate) y3 by feeding its inputs directly using the feed_dict argument. In this case, y2 and y1 are evaluated.

Ex:

import tensorflow as tf
import numpy as np

x = np.array([1.0, 2.0, 3.0])

x_var = tf.Variable(x, dtype=tf.float32)

y1 = tf.square(x_var)
y2 = tf.subtract(y1, tf.constant(1.0))

init_op = tf.global_variables_initializer()

with tf.Session() as sess:
    sess.run(init_op)

    print(sess.run(y2)) # Output: [ 0.  3.  8.]
    print(sess.run(y2, feed_dict={y1: [1.0, 1.0, 1.0]}))# Output: [ 0.  0.  0.]
I. A
  • 2,252
  • 26
  • 65