class_docstr: Proxy variable implementation.
class_docstr_tok: ["Proxy","variable","implementation","."]
docstr: Initialize the ProxyVariable.
  
  Args:
      resource_var (Variable): the variable to proxy.
      graph_item (GraphItem): the graph.
      proxy_device (DeviceSpecV2): the device to build the proxy on.
docstr_tok: ["Initialize","the","ProxyVariable",".","Args",":","resource_var","(","Variable",")",":","the","variable","to","proxy",".","graph_item","(","GraphItem",")",":","the","graph",".","proxy_device","(","DeviceSpecV2",")",":","the","device","to","build","the","proxy","on","."]
code: def __init__(self, resource_var, graph_item, proxy_device):
      """
      Initialize the ProxyVariable.
  
      Args:
          resource_var (Variable): the variable to proxy.
          graph_item (GraphItem): the graph.
          proxy_device (DeviceSpecV2): the device to build the proxy on.
      """
      self._graph_item = graph_item
      self._initial_value = graph_item.graph.get_tensor_by_name(
          resource_var.initial_value.name
      )
      self._dtype = resource_var.dtype.base_dtype
      self._this_op = graph_item.graph.get_operation_by_name(
          resource_var.op.name
      )
      self._read_var_ops = get_read_var_ops(self._this_op)
      self._consumer_to_read_var_op = {
          c: o for o in self._read_var_ops for c in get_consumers(o)
      }
      self._read_var_op_to_consumers = {
          o: get_consumers(o) for o in self._read_var_ops
      }
  
      self._optimizer_name_scope = parse_optimizer_scope(
          graph_item.var_op_name_to_grad_info[resource_var.op.name][
              2
          ].name
      )
      self._proxy_vars = []
      self._proxy_var_init_ops = []
      self._read_var_ops_mappings = defaultdict(dict)
  
      self._build_proxy_on(proxy_device)
  
file_path: autodist/autodist/kernel/common/proxy_variable.py
imports: from collections import defaultdict
  from tensorflow.core.framework.attr_value_pb2 import AttrValue
  from tensorflow.python import ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.util.compat import as_bytes
  from autodist.const import COLOCATION_PREFIX
  from autodist.kernel.common.utils import get_consumers, update_consumers, replica_prefix, AUTODIST_REPLICA_PREFIX, parse_optimizer_scope
  from autodist.kernel.common.variable_utils import get_read_var_ops, get_read_var_tensor, gen_read_var_op
  from autodist.utils import logging
label_desc: Use image node_id 1 to create a new ProxyVariable object  with example: obj = ProxyVariable(resource_var, graph_item, proxy_device)