python - Initializing variable with another variable using tensorflow -


i building neural network using denoising stacked autoencoders. train autoencoder , take matrix of weights w , copy/initialize/clone it's values new variable used in supervised optimization. how can such thing?

.initialized_value() doesn't work me :/

use var.assign, ie

vara = tf.variable(0) varb = tf.variable(0) init_op = tf.initialize_all_variables() sess = tf.interactivesession() sess.run([init_op]) sess.run([vara.assign_add(1)]) print 'variable a', vara.eval() print 'variable b', varb.eval() sess.run([varb.assign(vara)]) print 'variable b', varb.eval() 

you should see

variable 1 variable b 0 variable b 1 

Comments