tf.distribute.cluster_resolver.TFConfigClusterResolver

View source on GitHub

Implementation of a ClusterResolver which reads the TF_CONFIG EnvVar.

Inherits From: ClusterResolver

tf.distribute.cluster_resolver.TFConfigClusterResolver(
    task_type=None, task_id=None, rpc_layer=None, environment=None
)

This is an implementation of cluster resolvers when using TF_CONFIG to set information about the cluster. The cluster spec returned will be initialized from the TF_CONFIG environment variable.

Args:

Attributes:

Methods

cluster_spec

View source

cluster_spec()

Returns a ClusterSpec based on the TF_CONFIG environment variable.

Returns:

A ClusterSpec with information from the TF_CONFIG environment variable.

master

View source

master(
    task_type=None, task_id=None, rpc_layer=None
)

Returns the master address to use when creating a TensorFlow session.

Args:

Returns:

The address of the master.

Raises:

num_accelerators

View source

num_accelerators(
    task_type=None, task_id=None, config_proto=None
)

Returns the number of accelerator cores per worker.

This returns the number of accelerator cores (such as GPUs and TPUs) available per worker.

Optionally, we allow callers to specify the task_type, and task_id, for if they want to target a specific TensorFlow process to query the number of accelerators. This is to support heterogenous environments, where the number of accelerators cores per host is different.

Args:

Returns:

A map of accelerator types to number of cores.