class_docstr: Tests the Python interface to recomputation rewrites.
  
  See core/grappler/optimizers/memory_optimizer_test.cc for functional tests.
class_docstr_tok: ["Tests","the","Python","interface","to","recomputation","rewrites",".","See","core\/grappler\/optimizers\/memory_optimizer_test.cc","for","functional","tests","."]
docstr: Tests that rewriting occurs with non-standard gradient names.
docstr_tok: ["Tests","that","rewriting","occurs","with","non-standard","gradient","names","."]
code: def testRewritingNameScopedGradientNamesScope(self):
      """Tests that rewriting occurs with non-standard gradient names."""
      (original_metagraph, _, _, _) = self._GetMetaGraph(
          optimizer_scope_name="foo/bar"
      )
      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,
              layout_optimizer=rewriter_config_pb2.RewriterConfig.OFF,
              arithmetic_optimization=rewriter_config_pb2.RewriterConfig.OFF,
              memory_optimization=rewriter_config_pb2.RewriterConfig.RECOMPUTATION_HEURISTICS,
              # This should not match anything.
              memory_optimizer_target_node_name_scope="r/gradients/",
          )
      )
      rewritten_graph_def = tf_optimizer.OptimizeGraph(
          config, original_metagraph
      )
      self.assertEqual(
          len(rewritten_graph_def.node),
          len(original_metagraph.graph_def.node),
      )
      self.assertEqual(
          0,
          len(
              [
                  node
                  for node in original_metagraph.graph_def.node
                  if "Recomputed/" in node.name
              ]
          ),
      )
      self.assertEqual(
          0,
          len(
              [
                  node
                  for node in rewritten_graph_def.node
                  if "Recomputed/" in node.name
              ]
          ),
      )
  
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 4 for calling the MemoryOptimizerRecomputeTest obj's underlying member method code with example usage: obj.testRewritingNameScopedGradientNamesScope() without return types