Why can't I access the variable I create using the variable name plus scope path in TensorFlow?
<p>I was trying to get a variable I created in a simple function but I keep getting errors. I am doing:</p>

<pre><code>x = tf.get_variable('quadratic/x')
</code></pre>

<p>but the python complains as follow:</p>

<pre><code>python qm_tb_scopes.py
quadratic/x:0
Traceback (most recent call last):
  File "qm_tb_scopes.py", line 24, in &lt;module&gt;
    x = tf.get_variable('quadratic/x')
  File "/Users/my_username/path/tensor_flow_experiments/venv/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 732, in get_variable
    partitioner=partitioner, validate_shape=validate_shape)
  File "/Users/my_username/path/tensor_flow_experiments/venv/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 596, in get_variable
    partitioner=partitioner, validate_shape=validate_shape)
  File "/Users/my_username/path/tensor_flow_experiments/venv/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 161, in get_variable
    caching_device=caching_device, validate_shape=validate_shape)
  File "/Users/my_username/path/tensor_flow_experiments/venv/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 457, in _get_single_variable
    "but instead was %s." % (name, shape))
ValueError: Shape of a new variable (quadratic/x) must be fully defined, but instead was &lt;unknown&gt;.
</code></pre>

<p>it seems its trying to create a new variable, but I am simply trying to get a defined one. Why is it doing this?</p>

<p>The whole code is:</p>

<pre><code>import tensorflow as tf

def get_quaratic():
    # x variable
    with tf.variable_scope('quadratic'):
        x = tf.Variable(10.0,name='x')
        # b placeholder (simualtes the "data" part of the training)
        b = tf.placeholder(tf.float32,name='b')
        # make model (1/2)(x-b)^2
        xx_b = 0.5*tf.pow(x-b,2)
        y=xx_b
        return y,x

y,x = get_quaratic()
learning_rate = 1.0
# get optimizer
opt = tf.train.GradientDescentOptimizer(learning_rate)
# gradient variable list = [ (gradient,variable) ]
print x.name
x = tf.get_variable('quadratic/x')
x = tf.get_variable(x.name)
</code></pre>