autoencoder - Feeding a hidden tensor in Tensorflow -
i have autoencoder. model not important now. suppose model takes input image , output reconstructed image. after training, see effect of 1 tensor on output. in addition, images being fed autoencoder through fifoqueue. therefore, when running following peace of code:
reconstructed_image = sess.run([deconv_image], feed_dict={mu:my_vector}) where deconv_image output tensor of model , mu hidden tensor inside model; automatically feed model image queue.
my question is: value inside mu replaced whatever should come input image, or, takes vector fed using feed_dict argument.
any appreciated!!
when running final tensor, is, evaluating last tensor of graph, run tensors depends on. if have y3 operation depends on y2 , y2 depends on y1, then, running final tensor in graph cause y1 run first, y2 evaluated after gets input y1 , finally, output of y2 feed y3. graph follows: y1 -> y2 -> y3
on other hand, can run (evaluate) y3 feeding inputs directly using feed_dict argument. in case, y2 , y1 evaluated.
ex:
import tensorflow tf import numpy 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() tf.session() 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.]
Comments
Post a Comment