tf.distribute.cluster_resolver.SimpleClusterResolver
Stay organized with collections
Save and categorize content based on your preferences.
Simple implementation of ClusterResolver that accepts a ClusterSpec.
Inherits From: ClusterResolver
tf.distribute.cluster_resolver.SimpleClusterResolver(
cluster_spec, master='', task_type=None, task_id=None, environment='',
num_accelerators=None, rpc_layer=None
)
Attributes |
environment
|
Returns the current environment which TensorFlow is running in.
There are two possible return values, "google" (when TensorFlow is running
in a Google-internal environment) or an empty string (when TensorFlow is
running elsewhere).
If you are implementing a ClusterResolver that works in both the Google
environment and the open-source world (for instance, a TPU ClusterResolver
or similar), you will have to return the appropriate string depending on the
environment, which you will have to detect.
Otherwise, if you are implementing a ClusterResolver that will only work
in open-source TensorFlow, you do not need to implement this property.
|
rpc_layer
|
|
task_id
|
|
task_type
|
|
Methods
cluster_spec
View source
cluster_spec()
Returns the ClusterSpec passed into the constructor.
master
View source
master(
task_type=None, task_id=None, rpc_layer=None
)
Returns the master address to use when creating a session.
Args |
task_type
|
(Optional) The type of the TensorFlow task of the master.
|
task_id
|
(Optional) The index of the TensorFlow task of the master.
|
rpc_layer
|
(Optional) The RPC used by distributed TensorFlow.
|
Returns |
The name or URL of the session master.
|
If a task_type and task_id is given, this will override the master
string passed into the initialization function.
num_accelerators
View source
num_accelerators(
task_type=None, task_id=None, config_proto=None
)
Returns the number of accelerator cores per worker.
The SimpleClusterResolver does not do automatic detection of accelerators,
so a TensorFlow session will never be created, and thus all arguments are
unused and we simply assume that the type of accelerator is a GPU and return
the value in provided to us in the constructor.
Args |
task_type
|
Unused.
|
task_id
|
Unused.
|
config_proto
|
Unused.
|
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.distribute.cluster_resolver.SimpleClusterResolver\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 2 version](/api_docs/python/tf/distribute/cluster_resolver/SimpleClusterResolver) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/distribute/cluster_resolver/cluster_resolver.py#L182-L279) |\n\nSimple implementation of ClusterResolver that accepts a ClusterSpec.\n\nInherits From: [`ClusterResolver`](../../../tf/distribute/cluster_resolver/ClusterResolver)\n\n#### View aliases\n\n\n**Main aliases**\n\n\\`tf.contrib.cluster_resolver.SimpleClusterResolver\\`\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.distribute.cluster_resolver.SimpleClusterResolver`](/api_docs/python/tf/distribute/cluster_resolver/SimpleClusterResolver), \\`tf.compat.v2.distribute.cluster_resolver.SimpleClusterResolver\\`\n\n\u003cbr /\u003e\n\n tf.distribute.cluster_resolver.SimpleClusterResolver(\n cluster_spec, master='', task_type=None, task_id=None, environment='',\n num_accelerators=None, rpc_layer=None\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `environment` | Returns the current environment which TensorFlow is running in. \u003cbr /\u003e There are two possible return values, \"google\" (when TensorFlow is running in a Google-internal environment) or an empty string (when TensorFlow is running elsewhere). If you are implementing a ClusterResolver that works in both the Google environment and the open-source world (for instance, a TPU ClusterResolver or similar), you will have to return the appropriate string depending on the environment, which you will have to detect. Otherwise, if you are implementing a ClusterResolver that will only work in open-source TensorFlow, you do not need to implement this property. |\n| `rpc_layer` | \u003cbr /\u003e \u003cbr /\u003e |\n| `task_id` | \u003cbr /\u003e \u003cbr /\u003e |\n| `task_type` | \u003cbr /\u003e \u003cbr /\u003e |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `cluster_spec`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/distribute/cluster_resolver/cluster_resolver.py#L206-L208) \n\n cluster_spec()\n\nReturns the ClusterSpec passed into the constructor.\n\n### `master`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/distribute/cluster_resolver/cluster_resolver.py#L210-L229) \n\n master(\n task_type=None, task_id=None, rpc_layer=None\n )\n\nReturns the master address to use when creating a session.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-------------|------------------------------------------------------------|\n| `task_type` | (Optional) The type of the TensorFlow task of the master. |\n| `task_id` | (Optional) The index of the TensorFlow task of the master. |\n| `rpc_layer` | (Optional) The RPC used by distributed TensorFlow. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| The name or URL of the session master. ||\n\n\u003cbr /\u003e\n\nIf a task_type and task_id is given, this will override the `master`\nstring passed into the initialization function.\n\n### `num_accelerators`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/distribute/cluster_resolver/cluster_resolver.py#L251-L271) \n\n num_accelerators(\n task_type=None, task_id=None, config_proto=None\n )\n\nReturns the number of accelerator cores per worker.\n\nThe SimpleClusterResolver does not do automatic detection of accelerators,\nso a TensorFlow session will never be created, and thus all arguments are\nunused and we simply assume that the type of accelerator is a GPU and return\nthe value in provided to us in the constructor.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------------|---------|\n| `task_type` | Unused. |\n| `task_id` | Unused. |\n| `config_proto` | Unused. |\n\n\u003cbr /\u003e"]]