code: def demonstrate_loading_weights_into_different_scope_using_custom_function():
      print(
          "=" * 60
          + " Demonstrate loading weights saved in scopeQ, into variables now in scopeA, using custom map function"
      )
      tf.reset_default_graph()
  
      def vname_map(
          ename,
      ):  # variables were saved in scopeA, but we want to load into scopeQ
          name_in_file = ename.replace("scopeA", "scopeQ")
          print("%s -> %s" % (ename, name_in_file))
          return name_in_file
  
      with tf.variable_scope("scopeA") as scope:
          m1a = Model1()
          print(
              "=" * 60
              + " Trying to load model1 weights from scopeQ into scopeA"
          )
          m1a.model.load(
              "model1_scopeQ.tfl",
              variable_name_map=vname_map,
              verbose=True,
          )
  
imports: from __future__ import division, print_function, absolute_import
  import re
  import tflearn
  import tensorflow.compat.v1
  import tflearn.datasets.mnist
  from tflearn.layers.core import input_data, dropout, fully_connected
  from tflearn.layers.conv import conv_2d, max_pool_2d
  from tflearn.layers.normalization import local_response_normalization
  from tflearn.layers.estimator import regression
label_desc: Use image node_id 5 for calling a global function with example usage: demonstrate_loading_weights_into_different_scope_using_custom_function() and returns: name_in_file