Custom initializer for get_variable
<p>How can one specify a custom initializer as the third argument for <code>tf.get_variable()</code>? Specifically, I have a variable <code>y</code> which I want to initialize using another (already initialized) variable <code>x</code>. </p>

<p>This is easy to do using <code>tf.Variable()</code>, just say, <code>y = tf.Variable(x.initialized_value())</code>. But I couldn't find an analog in the documentation for <code>tf.get_variable()</code>.</p>

<p>You can use <code>x.initialized_value()</code> as well. For example:</p>

<pre><code>import tensorflow as tf

x = tf.Variable(1.0)
y = tf.get_variable('y', initializer=x.initialized_value())

with tf.Session() as sess:
    sess.run(tf.initialize_all_variables())
    print(sess.run(y)) #Â prints 1.0
</code></pre>

python tensorflow