class_docstr: Graph Transformer.
  
  This is the bulk of the AutoDist backend logic, taking a single-node,
  single-GPU graph and transforming it into a distributed
  graph. This all happens based on the `Strategy` provided.
  
  The transformation occurs over several steps:
  
  1. Partitions the necessary variables
  2. Replicates the graph the desired number of times
  3. Within the graph, synchronizes gradients with in-graph logic
  4. Adds between-graph gradient synchronization logic
code: def _prune_colocation_groups(graph_item):
      for op in graph_item.graph.get_operations():
          # Now prune the graph to have the right colocation constraints
          colocation_groups = [
              (c, graph_item.get_colocation_op(c))
              for c in op.colocation_groups()
          ]
          # We don't want any colocation groups that are just this `op`
          colocation_groups = [
              (c, bind_op)
              for (c, bind_op) in colocation_groups
              if bind_op != op
          ]
          if colocation_groups:
              device_to_bind_to = colocation_groups[-1][1].device
              new_colocation_groups = [
                  c
                  for (c, op) in colocation_groups
                  if op.device == device_to_bind_to
              ]
              op._set_device(device_to_bind_to)
              op._set_attr(
                  "_class",
                  pb2_AttrValue(
                      list=pb2_AttrValue.ListValue(
                          s=new_colocation_groups
                      )
                  ),
              )
          else:
              try:
                  if op.get_attr("_class"):
                      op._clear_attr("_class")
              except ValueError:
                  pass
  
file_path: autodist/autodist/kernel/graph_transformer.py
imports: from tensorflow.core.framework.attr_value_pb2 import AttrValue
  from tensorflow.python.eager import context
  from tensorflow.python.framework import device_spec
  from autodist.graph_item import GraphItem
  from autodist.kernel.partitioner import VariablePartitioner
  from autodist.kernel.replicator import Replicator
  from autodist.kernel.synchronization.synchronizer import Synchronizer
  from autodist.utils import logging, visualization_util
label_desc: Use image node_id 7 for calling the GraphTransformer obj's underlying member method code with example usage: obj._prune_colocation_groups(graph_item) without return types