code: def testMetricsCollection(self):
      def _enqueue_vector(sess, queue, values, shape=None):
          if not shape:
              shape = (1, len(values))
          dtype = queue.dtypes[0]
          sess.run(
              queue.enqueue(
                  constant_op.constant(values, dtype=dtype, shape=shape)
              )
          )
  
      meta_graph_filename = os.path.join(
          _TestDir("metrics_export"), "meta_graph.pb"
      )
  
      graph = ops.Graph()
      with self.session(graph=graph) as sess:
          values_queue = data_flow_ops.FIFOQueue(
              4, dtypes.float32, shapes=(1, 2)
          )
          _enqueue_vector(sess, values_queue, [0, 1])
          _enqueue_vector(sess, values_queue, [-4.2, 9.1])
          _enqueue_vector(sess, values_queue, [6.5, 0])
          _enqueue_vector(sess, values_queue, [-3.2, 4.0])
          values = values_queue.dequeue()
  
          _, update_op = metrics.mean(values)
  
          initializer = variables.local_variables_initializer()
          self.evaluate(initializer)
          self.evaluate(update_op)
  
      meta_graph.export_scoped_meta_graph(
          filename=meta_graph_filename, graph=graph
      )
  
      # Verifies that importing a meta_graph with LOCAL_VARIABLES collection
      # works correctly.
      graph = ops.Graph()
      with self.session(graph=graph) as sess:
          meta_graph.import_scoped_meta_graph(meta_graph_filename)
          initializer = variables.local_variables_initializer()
          self.evaluate(initializer)
  
      # Verifies that importing an old meta_graph where "local_variables"
      # collection is of node_list type works, but cannot build initializer
      # with the collection.
      graph = ops.Graph()
      with self.session(graph=graph) as sess:
          meta_graph.import_scoped_meta_graph(
              test.test_src_dir_path(
                  "python/framework/testdata/metrics_export_meta_graph.pb"
              )
          )
          self.assertEqual(
              len(ops.get_collection(ops.GraphKeys.LOCAL_VARIABLES)), 2
          )
          with self.assertRaisesRegex(
              AttributeError, "has no attribute 'initializer'"
          ):
              initializer = variables.local_variables_initializer()
  
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 1 for calling the MetaGraphWithVariableScopeTest obj's underlying member method code with example usage: obj.testMetricsCollection() without return types