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`.
docstr: A mapping from VarHandleOp name (e.g. "W" not "W:0") to its (grad, var, update_op) tuple.
docstr_tok: ["A","mapping","from","VarHandleOp","name","(","e.g",".","``","W","''","not","``","W:0","''",")","to","its","(","grad",",","var",",","update_op",")","tuple","."]
code: def var_op_name_to_grad_info(self):
      """A mapping from VarHandleOp name (e.g. "W" not "W:0") to its (grad, var, update_op) tuple."""
      if not self.updated and not self.loop_phase:
          return self.var_op_name_to_grad_dict
      expected_var_ops = {
          var.op: (grad, var)
          for grad, var in self.grad_target_pairs.items()
      }
      res = {}
      for op in self.all_update_ops:
          var_op = op.inputs[op_info.UPDATE_OP_VAR_POS].op
          on_trainable_variable = var_op in expected_var_ops
          var_scope = var_op.name
          update_op_scope = parse_name_scope(op.name)
          is_initialization = update_op_scope == var_scope
          # TODO: we should not hardcode this scope.
          # It is actually coming from the name given to the saver
          is_saving = update_op_scope.endswith("save")
  
          # TODO(future): support one variable -> multiple update ops (see AdamWeightDecay optimizer)
          if (
              on_trainable_variable
              and not is_initialization
              and not is_saving
              and not self._is_auxiliary(op)
          ):
              if var_op.name in res:
                  raise ValueError(
                      "A variable cannot correspond to more than one update op for now."
                  )
              res[var_op.name] = expected_var_ops[var_op] + (op,)
      self.updated = False
      self.var_op_name_to_grad_dict = res
      return res
  
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 14 for calling the GraphItem obj's underlying member method code with example usage: obj.var_op_name_to_grad_info() and returns: res, self