class_docstr: Data-parallel training in 'ParameterServer' mode.
  It builds one tower on each GPU with
  shared variable scope. It synchronizes the gradients computed
  from each tower, averages them and applies to the shared variables.
  
  It is an equivalent of ``--variable_update=parameter_server`` in
  `tensorflow/benchmarks <https://github.com/tensorflow/benchmarks>`_.
class_docstr_tok: ["Data-parallel","training","in","'ParameterServer","'","mode",".","It","builds","one","tower","on","each","GPU","with","shared","variable","scope",".","It","synchronizes","the","gradients","computed","from","each","tower",",","averages","them","and","applies","to","the","shared","variables",".","It","is","an","equivalent","of","``","--","variable_update=parameter_server","``","in","`","tensorflow\/benchmarks","<","https",":","\/\/github.com\/tensorflow\/benchmarks",">","`","_","."]
docstr: Call the function `tower_fn` under :class:`TowerContext` for each tower.
  
  Returns:
      a list, contains the return values of `tower_fn` on each tower.
docstr_tok: ["Call","the","function","`","tower_fn","`","under",":","class",":","`","TowerContext","`","for","each","tower",".","Returns",":","a","list",",","contains","the","return","values","of","`","tower_fn","`","on","each","tower","."]
code: def call_for_each_tower(self, tower_fn):
      """
      Call the function `tower_fn` under :class:`TowerContext` for each tower.
  
      Returns:
          a list, contains the return values of `tower_fn` on each tower.
      """
      raw_devices = ["/gpu:{}".format(k) for k in self.towers]
      if self.ps_device == "gpu" or get_tf_version_tuple() >= (2, 0):
          devices = [
              LeastLoadedDeviceSetter(d, raw_devices)
              for d in raw_devices
          ]
      else:
          # TODO not working in TF2 - cause model to run on CPUs
          devices = [
              tf.train.replica_device_setter(
                  worker_device=d, ps_device="/cpu:0", ps_tasks=1
              )
              for d in raw_devices
          ]
  
      return DataParallelBuilder.build_on_towers(
          self.towers, tower_fn, devices
      )
  
imports: import copy
  import pprint
  import re
  from abc import ABCMeta, abstractmethod
  from contextlib import contextmanager
  import six
  import tensorflow
  from ..compat import tfv1
  from ..tfutils.common import get_tf_version_tuple
  from ..tfutils.gradproc import ScaleGradient
  from ..tfutils.tower import TrainTowerContext
  from ..utils import logger
  from ..utils.develop import HIDE_DOC
  from .utils import GradientPacker, LeastLoadedDeviceSetter, aggregate_grads_colocate, allreduce_grads_naive, allreduce_grads, allreduce_grads_hierarchical, merge_grad_list, override_to_local_variable, split_grad_list
label_desc: Use image node_id 2 for calling the SyncMultiGPUParameterServerBuilder obj's underlying member method code with example usage: obj.call_for_each_tower(tower_fn) and returns: DataParallelBuilder