code: def _createGraphWithCustomOp(self, opname="CustomAdd"):
      custom_opdefs_str = (
          "name: '"
          + opname
          + "' input_arg: {name: 'Input1' type: DT_FLOAT} "
          "input_arg: {name: 'Input2' type: DT_FLOAT} output_arg: {name: "
          "'Output' type: DT_FLOAT}"
      )
  
      # Create a graph that has one add op.
      new_graph = graph_pb2.GraphDef()
      with ops.Graph().as_default():
          with session.Session() as sess:
              in_tensor = array_ops.placeholder(
                  shape=[1, 16, 16, 3],
                  dtype=dtypes.float32,
                  name="input",
              )
              out_tensor = in_tensor + in_tensor
              inputs = {"x": in_tensor}
              outputs = {"z": out_tensor}
  
              new_graph.CopyFrom(sess.graph_def)
  
      # Rename Add op name to opname.
      for node in new_graph.node:
          if node.op.startswith("Add"):
              node.op = opname
              del node.attr["T"]
  
      # Register custom op defs to import modified graph def.
      register_custom_opdefs([custom_opdefs_str])
  
      return (new_graph, inputs, outputs)
  
imports: import os
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow.core.framework import graph_pb2
  from tensorflow.lite.python import lite
  from tensorflow.lite.python import test_util
  from tensorflow.lite.python.convert import register_custom_opdefs
  from tensorflow.lite.python.interpreter import Interpreter
  from tensorflow.lite.python.testdata import double_op
  from tensorflow.python.client import session
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.framework.importer import import_graph_def
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import list_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.saved_model import saved_model
  from tensorflow.python.trackable import autotrackable
label_desc: Use image node_id 1 for calling the WithCustomOpTest obj's underlying member method code with example usage: obj._createGraphWithCustomOp(opname) and returns: new_graph,  inputs,  outputs