def METHOD_NAME(comp):
  """Gets counter of device placement for tensorflow compuation `comp`."""
  py_typecheck.check_type(comp, building_blocks.ComputationBuildingBlock)
  if (
      not isinstance(comp, building_blocks.CompiledComputation)
      or comp.proto.WhichOneof('computation') != 'tensorflow'
  ):
    raise ValueError(
        'Please pass a '
        '`building_blocks.CompiledComputation` of the '
        '`tensorflow` variety to `get_device_placement_in`. (Got '
        'a [{t}]).'.format(t=type(comp))
    )
  graph_def = serialization_utils.unpack_graph_def(
      comp.proto.tensorflow.graph_def
  )
  counter = collections.Counter()
  def _populate_counter_in_function_lib(func_library):
    for graph_func in func_library.function:
      counter.update(node.device for node in graph_func.node_def)
    for graph_func in func_library.gradient:
      counter.update(node.device for node in graph_func.node_def)
  counter.update(node.device for node in graph_def.node)
  _populate_counter_in_function_lib(graph_def.library)
  return counter