code: def test_run_in_graph_and_eager_modes(self):
      l = []
  
      def inc(self, with_brackets):
          del self  # self argument is required by run_in_graph_and_eager_modes.
          mode = "eager" if tf.executing_eagerly() else "graph"
          with_brackets = (
              "with_brackets" if with_brackets else "without_brackets"
          )
          l.append((with_brackets, mode))
  
      f = test_utils.run_in_graph_and_eager_modes(inc)
      f(self, with_brackets=False)
      f = test_utils.run_in_graph_and_eager_modes()(inc)
      f(self, with_brackets=True)
  
      self.assertEqual(len(l), 4)
      self.assertEqual(
          set(l),
          {
              ("with_brackets", "graph"),
              ("with_brackets", "eager"),
              ("without_brackets", "graph"),
              ("without_brackets", "eager"),
          },
      )
  
file_path: tensor2tensor/tensor2tensor/utils/test_utils_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.utils import test_utils
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling the RunInGraphAndEagerTest obj's underlying member method code with example usage: obj.test_run_in_graph_and_eager_modes() without return types