code: def test_merge_graph_defs_gradient(self):
      expected_proto = """
              library {
                gradient {
                  function_name: "graph_1_foo"
                  gradient_func: "graph_1_foo_grad"
                }
                gradient {
                  function_name: "graph_2_foo"
                  gradient_func: "graph_2_foo_grad"
                }
                gradient {
                  function_name: "graph_2_bar"
                  gradient_func: "graph_2_bar_grad"
                }
              }
          """
  
      graph_def_a = GraphDef()
      text_format.Parse(
          """
                  library {
                    gradient {
                      function_name: "foo"
                      gradient_func: "foo_grad"
                    }
                  }
              """,
          graph_def_a,
      )
  
      graph_def_b = GraphDef()
      text_format.Parse(
          """
                  library {
                    gradient {
                      function_name: "foo"
                      gradient_func: "foo_grad"
                    }
                    gradient {
                      function_name: "bar"
                      gradient_func: "bar_grad"
                    }
                  }
              """,
          graph_def_b,
      )
  
      self.assertProtoEquals(
          expected_proto,
          graph_util.merge_graph_defs([graph_def_a, graph_def_b]),
      )
  
file_path: tensorboard/tensorboard/plugins/graph/graph_util_test.py
imports: from google.protobuf import text_format
  import tensorflow
  from tensorboard.compat.proto.graph_pb2 import GraphDef
  from tensorboard.plugins.graph import graph_util
label_desc: Use image node_id 5 for calling the GraphUtilTest obj's underlying member method code with example usage: obj.test_merge_graph_defs_gradient() without return types