class_docstr: Helper class to assign variables on the least loaded ps-device.
  
  Usage:
  
      .. code-block:: python
  
          with tf.device(LeastLoadedDeviceSetter(...)):
              ...
code: def place_with_balance(self, op):
      device_index, _ = min(
          enumerate(self.ps_sizes), key=operator.itemgetter(1)
      )
      device_name = self.ps_devices[device_index]
      var_size = op.outputs[0].get_shape().num_elements()
      if var_size is None:
          logger.warn(
              "[LeastLoadedDeviceSetter] Shape of variable {} is not fully defined!".format(
                  op.name
              )
          )
          var_size = 0
      self.ps_sizes[device_index] += var_size
      return device_name
  
imports: import operator
  from contextlib import contextmanager
  import tensorflow
  import threading
  from ..compat import tfv1
  from ..tfutils.common import get_tf_version_tuple
  from ..tfutils.scope_utils import cached_name_scope, under_name_scope
  from ..tfutils.varreplace import custom_getter_scope
  from ..utils import logger
  from ..utils.argtools import call_only_once
label_desc: Use image node_id 3 for calling the LeastLoadedDeviceSetter obj's underlying member method code with example usage: obj.place_with_balance(op) and returns: device_name