with tf.name_scope("subgraph_1"): with tf.variable_scope(tf.get_variable_scope(), resue=False): y_1 = output(x_1) with tf.name_scope("subgraph_2"): with tf.variable_scope(tf.get_variable_scope(), reuse=True): y_2 = output(x_2)