class_docstr: Tests the Grappler memory optimizer.
class_docstr_tok: ["Tests","the","Grappler","memory","optimizer","."]
docstr: Make sure the graph is preserved when there is nothing to swap.
docstr_tok: ["Make","sure","the","graph","is","preserved","when","there","is","nothing","to","swap","."]
code: def testNoSwapping(self):
      """Make sure the graph is preserved when there is nothing to swap."""
      a = variable_v1.VariableV1(10, name="a")
      b = variable_v1.VariableV1(20, name="b")
      c = math_ops.add_n([a, b], name="c")
      d = math_ops.add_n([b, c], name="d")
      train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP)
      train_op.append(d)
      mg = meta_graph.create_meta_graph_def(
          graph=ops.get_default_graph()
      )
      graph_size = len(mg.graph_def.node)
      nodes = [node.name for node in mg.graph_def.node]
  
      config = config_pb2.ConfigProto()
      config.graph_options.rewrite_options.CopyFrom(
          rewriter_config_pb2.RewriterConfig(
              disable_model_pruning=True,
              constant_folding=rewriter_config_pb2.RewriterConfig.OFF,
              dependency_optimization=rewriter_config_pb2.RewriterConfig.OFF,
              memory_optimization=rewriter_config_pb2.RewriterConfig.MANUAL,
          )
      )
      graph = tf_optimizer.OptimizeGraph(config, mg)
  
      self.assertEqual(len(graph.node), graph_size)
      self.assertItemsEqual([node.name for node in graph.node], nodes)
  
imports: from tensorflow.core.framework import attr_value_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.framework import meta_graph
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import random_seed
  from tensorflow.python.framework import test_util
  from tensorflow.python.grappler import tf_optimizer
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.training import training
label_desc: Use image node_id 1 for calling the MemoryOptimizerSwapTest obj's underlying member method code with example usage: obj.testNoSwapping() without return types