class_docstr: Used to perform in-graph replication on a computational graph.
  
  That is, Replicator is used to create _n_ replicas of a `tf.Graph`,
  with all replicas being stored in a new `tf.Graph` and delineated
  with name scopes.
  
  This also handles ControlFlowContexts, updating variable and gradient
  information, etc.
class_docstr_tok: ["Used","to","perform","in-graph","replication","on","a","computational","graph",".","That","is",",","Replicator","is","used","to","create","_n_","replicas","of","a","`","tf.Graph","`",",","with","all","replicas","being","stored","in","a","new","`","tf.Graph","`","and","delineated","with","name","scopes",".","This","also","handles","ControlFlowContexts",",","updating","variable","and","gradient","information",",","etc","."]
docstr: Apply replication to a graph.
  
  Returns:
      GraphItem
docstr_tok: ["Apply","replication","to","a","graph",".","Returns",":","GraphItem"]
code: def _apply(self, *args, **kwargs):
      """
      Apply replication to a graph.
  
      Returns:
          GraphItem
      """
      new_graph_item = self._graph_item
      if self._num_local_replicas >= 1:
          new_graph_item = self.replicate(new_graph_item)
          logging.debug("Successfully replicated operations")
      return new_graph_item
  
file_path: autodist/autodist/kernel/replicator.py
imports: from tensorflow.python import ops, import_graph_def
  from tensorflow.python.framework import device_spec, kernels
  from tensorflow.python.framework.device_spec import DeviceSpecV2
  from tensorflow.python.ops.control_flow_ops import WhileContext
  from tensorflow.python.ops.control_flow_util import GetWhileContext
  from tensorflow.python.ops.resource_variable_ops import _from_proto_fn
  from autodist.graph_item import GraphItem
  from autodist.kernel.common.utils import replica_prefix
  from autodist.kernel.kernel import Kernel
  from autodist.checkpoint.saver import Saver
  from autodist.utils import logging
label_desc: Use image node_id 2 for calling the Replicator obj's underlying member method code with example usage: obj._apply() and returns: new_graph_item