tf.contrib.training.GreedyLoadBalancingStrategy
Stay organized with collections
Save and categorize content based on your preferences.
Returns the least-loaded ps task for op placement.
tf.contrib.training.GreedyLoadBalancingStrategy(
num_tasks, load_fn
)
The load is calculated by a user-specified load function passed in at
construction. There are no units for load, and the load function is
responsible for providing an internally consistent measure.
Note that this strategy is very sensitive to the exact order in which
ps ops (typically variables) are created, as it greedily places ops
on the least-loaded ps at the point each op is processed.
One reasonable heuristic is the byte_size_load_fn
, which
estimates load as the number of bytes that would be used to store and
transmit the entire variable. More advanced load functions
could consider the difference in access patterns across ops, or trade
off CPU-intensive ops with RAM-intensive ops with network bandwidth.
This class is intended to be used as a ps_strategy
in
tf.compat.v1.train.replica_device_setter
.
Args |
num_tasks
|
Number of ps tasks to cycle among.
|
load_fn
|
A callable that takes an Operation and returns a
numeric load value for that op.
|
Methods
__call__
View source
__call__(
op
)
Choose a ps task index for the given Operation
.
Args |
op
|
A Operation to be placed on ps.
|
Returns |
The next ps task index to use for the Operation . Greedily
places the op on the least-loaded ps task so far, as determined
by the load function.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.training.GreedyLoadBalancingStrategy\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/training/python/training/device_setter.py#L56-L102) |\n\nReturns the least-loaded ps task for op placement. \n\n tf.contrib.training.GreedyLoadBalancingStrategy(\n num_tasks, load_fn\n )\n\nThe load is calculated by a user-specified load function passed in at\nconstruction. There are no units for load, and the load function is\nresponsible for providing an internally consistent measure.\n\nNote that this strategy is very sensitive to the exact order in which\nps ops (typically variables) are created, as it greedily places ops\non the least-loaded ps at the point each op is processed.\n\nOne reasonable heuristic is the `byte_size_load_fn`, which\nestimates load as the number of bytes that would be used to store and\ntransmit the entire variable. More advanced load functions\ncould consider the difference in access patterns across ops, or trade\noff CPU-intensive ops with RAM-intensive ops with network bandwidth.\n\nThis class is intended to be used as a `ps_strategy` in\n[`tf.compat.v1.train.replica_device_setter`](../../../tf/train/replica_device_setter).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|------------------------------------------------------------------------------------|\n| `num_tasks` | Number of ps tasks to cycle among. |\n| `load_fn` | A callable that takes an `Operation` and returns a numeric load value for that op. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/training/python/training/device_setter.py#L89-L102) \n\n __call__(\n op\n )\n\nChoose a ps task index for the given `Operation`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------|-----------------------------------|\n| `op` | A `Operation` to be placed on ps. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| The next ps task index to use for the `Operation`. Greedily places the op on the least-loaded ps task so far, as determined by the load function. ||\n\n\u003cbr /\u003e"]]