code: def _testScopedImport(self, test_dir, exported_filenames):
      graph = ops.Graph()
      # Create all the missing inputs.
      with graph.as_default():
          new_image = constant_op.constant(
              1.2, dtypes.float32, shape=[100, 28], name="images"
          )
  
      with self.assertRaisesRegex(
          ValueError, "Graph contains unbound inputs"
      ):
          meta_graph.import_scoped_meta_graph(
              os.path.join(test_dir, exported_filenames[0]),
              graph=graph,
              import_scope="new_hidden1",
          )
  
      with self.assertRaisesRegex(
          ValueError, "Graph contains unbound inputs"
      ):
          meta_graph.import_scoped_meta_graph(
              os.path.join(test_dir, exported_filenames[0]),
              graph=graph,
              input_map={"image:0": new_image},
              import_scope="new_hidden1",
          )
  
      # Verifies we can import the original "hidden1" into "new_hidden1".
      var_list = meta_graph.import_scoped_meta_graph(
          os.path.join(test_dir, exported_filenames[0]),
          graph=graph,
          input_map={"$unbound_inputs_images": new_image},
          import_scope="new_hidden1",
      )
  
      self.assertEqual(
          ["biases:0", "weights:0"], sorted(var_list.keys())
      )
      new_var_names = [v.name for _, v in var_list.items()]
      self.assertEqual(
          ["new_hidden1/biases:0", "new_hidden1/weights:0"],
          sorted(new_var_names),
      )
  
      # Verifies we can import the original "hidden2" into "new_hidden2".
      hidden1 = array_ops.identity(
          graph.as_graph_element("new_hidden1/Relu:0"),
          name="hidden1/Relu",
      )
      var_list = meta_graph.import_scoped_meta_graph(
          os.path.join(test_dir, exported_filenames[1]),
          graph=graph,
          input_map={"$unbound_inputs_hidden1/Relu": hidden1},
          import_scope="new_hidden2",
          unbound_inputs_col_name=None,
      )
  
      self.assertEqual(
          ["biases:0", "weights:0"], sorted(var_list.keys())
      )
      new_var_names = [v.name for _, v in var_list.items()]
      self.assertEqual(
          ["new_hidden2/biases:0", "new_hidden2/weights:0"],
          sorted(new_var_names),
      )
  
      # Verifies we can import the original "softmax_linear" into
      # "new_softmax_linear".
      hidden2 = array_ops.identity(
          graph.as_graph_element("new_hidden2/Relu:0"),
          name="hidden2/Relu",
      )
      var_list = meta_graph.import_scoped_meta_graph(
          os.path.join(test_dir, exported_filenames[2]),
          graph=graph,
          input_map={"$unbound_inputs_hidden2/Relu": hidden2},
          import_scope="new_softmax_linear",
          unbound_inputs_col_name=None,
      )
      self.assertEqual(
          ["biases:0", "weights:0"], sorted(var_list.keys())
      )
      new_var_names = [v.name for _, v in var_list.items()]
      self.assertEqual(
          [
              "new_softmax_linear/biases:0",
              "new_softmax_linear/weights:0",
          ],
          sorted(new_var_names),
      )
  
      # Exports the scoped meta graphs again.
      new_meta_graph1, var_list = meta_graph.export_scoped_meta_graph(
          graph=graph, export_scope="new_hidden1"
      )
      self.assertEqual(
          ["biases:0", "weights:0"], sorted(var_list.keys())
      )
  
      new_meta_graph2, var_list = meta_graph.export_scoped_meta_graph(
          graph=graph,
          export_scope="new_hidden2",
          unbound_inputs_col_name=None,
      )
      self.assertEqual(
          ["biases:0", "weights:0"], sorted(var_list.keys())
      )
  
      new_meta_graph3, var_list = meta_graph.export_scoped_meta_graph(
          graph=graph,
          export_scope="new_softmax_linear",
          unbound_inputs_col_name=None,
      )
      self.assertEqual(
          ["biases:0", "weights:0"], sorted(var_list.keys())
      )
  
      return [new_meta_graph1, new_meta_graph2, new_meta_graph3]
  
imports: import math
  import os.path
  import random
  import shutil
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.python.client import session
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import function
  from tensorflow.python.framework import meta_graph
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import data_flow_ops
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import metrics
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import partitioned_variables
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variables
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import test
  from tensorflow.python.training import queue_runner_impl
label_desc: Use image node_id 2 for calling the ScopedMetaGraphTest obj's underlying member method code with example usage: obj._testScopedImport(test_dir, exported_filenames) and returns: list