Why doesn't the code below return two equal variables?
with tf.compat.v1.variable_scope('layer1', reuse=tf.compat.v1.AUTO_REUSE):
w1 = tf.compat.v1.get_variable(name = 'w',initializer = tf.random.normal(shape=[1,1], mean=0, stddev=1))
w2 = tf.compat.v1.get_variable(name = 'w',initializer = tf.random.normal(shape=[1,1], mean=0, stddev=1))
print(w1)
print(w2)
It returns two variables that share the same name but with two different values:
<tf.Variable 'layer1/w:0' shape=(1, 1) dtype=float32, numpy=array([[-1.6276217]], dtype=float32)>
<tf.Variable 'layer1/w:0' shape=(1, 1) dtype=float32, numpy=array([[1.6553603]], dtype=float32)>