(self)
Returns the device to use for variables created inside the clone.

    Returns:
      A value suitable for `tf.device()`.
Returns the device to use for variables created inside the clone.
Returns the device to use for variables created inside the clone .
def variables_device(self):
    """Returns the device to use for variables created inside the clone.

    Returns:
      A value suitable for `tf.device()`.
    """
    device = ''
    if self._num_ps_tasks > 0:
      device += self._ps_device
    device += '/device:CPU:0'

    class _PSDeviceChooser(object):
      """Slim device chooser for variables when using PS."""

      def __init__(self, device, tasks):
        self._device = device
        self._tasks = tasks
        self._task = 0

      def choose(self, op):
        if op.device:
          return op.device
        node_def = op if isinstance(op, tf.NodeDef) else op.node_def
        if node_def.op == 'Variable':
          t = self._task
          self._task = (self._task + 1) % self._tasks
          d = '%s/task:%d' % (self._device, t)
          return d
        else:
          return op.device

    if not self._num_ps_tasks:
      return device
    else:
      chooser = _PSDeviceChooser(device, self._num_ps_tasks)
      return chooser.choose
def variables_device ( self ) : device = '' if self . _num_ps_tasks > 0 : device += self . _ps_device device += '/device:CPU:0' class _PSDeviceChooser ( object ) : """Slim device chooser for variables when using PS.""" def __init__ ( self , device , tasks ) : self . _device = device self . _tasks = tasks self . _task = 0 def choose ( self , op ) : if op . device : return op . device node_def = op if isinstance ( op , tf . NodeDef ) else op . node_def if node_def . op == 'Variable' : t = self . _task self . _task = ( self . _task + 1 ) % self . _tasks d = '%s/task:%d' % ( self . _device , t ) return d else : return op . device if not self . _num_ps_tasks : return device else : chooser = _PSDeviceChooser ( device , self . _num_ps_tasks ) return chooser . choose