class_docstr: GraphItem is a TensorFlow Graph wrapper.
  
  It represents the states in-between consecutive AutoDist.kernel graph transformations.
  tf.Graph is the primary property of GraphItem, whereas MetaGraph is exported/generated on demand.
  
  A GraphItem can be constructed with either a `tf.Graph` or a `GraphDef`.
code: def __init__(
      self, graph: ops.Graph = None, graph_def: GraphDef = None
  ):
      if graph:
          self._graph = graph
      elif graph_def:
          self._graph = ops.Graph()
          with self._graph.as_default():
              import_graph_def(graph_def, name="")
      else:
          self._graph = ops.Graph()
  
      # grad tensor name --> variable name  (state-delta tensor name --> stateful op name)
      self._grad_target_pairs = {}
  
      ###################################
      # Info
      self.info = Info()
      self.optimizer, self.optimizer_args, self.optimizer_kwargs = (
          None,
          None,
          None,
      )
      # Optimizing the var_op_name_to_grad query.
      # used to inform the var_op_name_to_grad_dict that the graph has been modified
      # only used when the synchronizer is calling the lookup with optimize=True
      self.updated = True
      # used to cached the result of var_op_name_to_grad function from last time
      self.var_op_name_to_grad_dict = dict()
      # map the updated op to its inputs variables, used to optimize var_op_name_to_grad
      self.update_op_depend_var = defaultdict(list)
  
      # on if this graph is in loop optimize mode for the first time
      self.first_time_loop = True
      self.loop_phase = False
      self.var_queried = []
      self.useful_update_op = []
  
imports: import contextlib
  import copy
  import functools
  from collections import defaultdict
  from typing import Union, Callable
  from google.protobuf.any_pb2 import Any
  from tensorflow.core.framework.graph_pb2 import GraphDef
  from tensorflow.core.framework.variable_pb2 import VariableDef
  from tensorflow.core.protobuf.saver_pb2 import SaverDef
  from tensorflow.python.framework import ops
  from tensorflow.python.framework.importer import import_graph_def
  from tensorflow.python.ops.resource_variable_ops import _from_proto_fn
  from tensorflow.python.ops.variables import Variable
  from autodist.const import COLOCATION_PREFIX
  from autodist.kernel.common import op_info
  from autodist.kernel.common.utils import parse_name_scope, get_op_name
  from autodist.proto import graphitem_pb2
  from autodist.utils import logging
label_desc: Use image node_id 1 to create a new GraphItem object  with example: obj = GraphItem(graph, graph_def)