Currently I am building a couple of neural networks in a scope and I want to access those networks from another scope.

I have tried passing the scopes but as mentioned in few other answers on stack overflow but none of that works. For example

def mlp_model(input, num_outputs, scope, reuse=False, num_units=64, rnn_cell=None): # This model takes as input an observation and returns values of all actions with tf.variable_scope(scope, reuse=reuse): out = input out = layers.dense(out, units=num_units, activation=tf.nn.relu) out = layers.dense(out, units=num_units, activation=tf.nn.relu) out = layers.dense(out, units=num_outputs, activation=None) return out input_placeholder = tf.placeholder(tf.float32, shape=(None, 64), name="input") with tf.variable_scope("agent_0") as agent_scope: q_func= mlp_model(input_placeholder, 2, "q_func", num_units=64) with tf.variable_scope("agent_1"): with tf.variable_scope(agent_scope, reuse=True): q_func_2=mlp_model(input_placeholder, 2, "q_func", num_units=64, reuse=True)

when I see the name of q_func it says "agent_0/q_func/dense_2/BiasAdd:0" and when I see the name of q_func_2 it says "agent_1/agent_0/q_func/dense_2/BiasAdd:0"

I want to figure out how to do q_func == q_func_2