<jupyter_start><jupyter_text>As shown above, if the variable scope is not specified, the variables with the same name will be **automatically distinguished by adding extra suffix.**<jupyter_code>def conv_relu(input, kernel_shape, bias_shape):
    # Create variable named "weights".
    weights = tf.get_variable("weights", kernel_shape,
        initializer=tf.random_normal_initializer())
    # Create variable named "biases".
    biases = tf.get_variable("biases", bias_shape,
        initializer=tf.constant_initializer(0.0))
    conv = tf.nn.conv2d(input, weights,
        strides=[1, 1, 1, 1], padding='SAME')
    return tf.nn.relu(conv + biases)
def my_image_filter(input_images):
    with tf.variable_scope("conv1"):
        # Variables created here will be named "conv1/weights", "conv1/biases".
        relu1 = conv_relu(input_images, [5, 5, 32, 32], [32])
    with tf.variable_scope("conv2"):
        # Variables created here will be named "conv2/weights", "conv2/biases".
        return conv_relu(relu1, [5, 5, 32, 32], [32])
#result1 = my_image_filter(image1)
#result2 = my_image_filter(image2)<jupyter_output><empty_output><jupyter_text>If we explicitly specify the variable name scope and **use get_variable to create or get exsited variables**, there will be no automatic suffix. And in this situation, if we don't allow the reuse of variables, variables with the same name will incur a conflict and raise an error.<jupyter_code># Should do like this
with tf.variable_scope("image_filters") as scope:
    result1 = my_image_filter(image1)
    scope.reuse_variables()
    result2 = my_image_filter(image2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10618932038834951, 'fraction_numerical': 0.02366504854368932, 'mean_word_length': 4.666666666666667, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '491089', 'license': 'MIT', 'n_tokens_mistral': 534, 'n_tokens_neox': 512, 'n_words': 154, 'path': 'variable/variable.ipynb', 'repo_name': 'woodfrog/tf_notes', 'size': '1648'}