class_docstr: Simple implementation of ClusterResolver that accepts all attributes.
  
  Please see the base class for documentation of arguments of its constructor.
  
  It is useful if you want to specify some or all attributes.
  
  Usage example with `tf.distribute.Strategy`:
  
    ```Python
    cluster = tf.train.ClusterSpec({"worker": ["worker0.example.com:2222",
                                               "worker1.example.com:2222"]})
  
    # On worker 0
    cluster_resolver = SimpleClusterResolver(cluster, task_type="worker",
                                             task_id=0,
                                             num_accelerators={"GPU": 8},
                                             rpc_layer="grpc")
    strategy = tf.distribute.experimental.MultiWorkerMirroredStrategy(
        cluster_resolver=cluster_resolver)
  
    # On worker 1
    cluster_resolver = SimpleClusterResolver(cluster, task_type="worker",
                                             task_id=1,
                                             num_accelerators={"GPU": 8},
                                             rpc_layer="grpc")
    strategy = tf.distribute.experimental.MultiWorkerMirroredStrategy(
        cluster_resolver=cluster_resolver)
    ```
class_docstr_tok: ["Simple","implementation","of","ClusterResolver","that","accepts","all","attributes",".","Please","see","the","base","class","for","documentation","of","arguments","of","its","constructor",".","It","is","useful","if","you","want","to","specify","some","or","all","attributes",".","Usage","example","with","`","tf.distribute.Strategy","`",":","``","`","Python","cluster","=","tf.train.ClusterSpec","(","{","``","worker","''",":","[","``","worker0.example.com:2222","''",",","``","worker1.example.com:2222","''","]","}",")","#","On","worker","0","cluster_resolver","=","SimpleClusterResolver","(","cluster",",","task_type=","''","worker","''",",","task_id=0",",","num_accelerators=","{","``","GPU","''",":","8","}",",","rpc_layer=","''","grpc","''",")","strategy","=","tf.distribute.experimental.MultiWorkerMirroredStrategy","(","cluster_resolver=cluster_resolver",")","#","On","worker","1","cluster_resolver","=","SimpleClusterResolver","(","cluster",",","task_type=","''","worker","''",",","task_id=1",",","num_accelerators=","{","``","GPU","''",":","8","}",",","rpc_layer=","''","grpc","''",")","strategy","=","tf.distribute.experimental.MultiWorkerMirroredStrategy","(","cluster_resolver=cluster_resolver",")","``","`"]
docstr: Creates a SimpleClusterResolver from a ClusterSpec.
docstr_tok: ["Creates","a","SimpleClusterResolver","from","a","ClusterSpec","."]
code: def __init__(
      self,
      cluster_spec,
      master="",
      task_type=None,
      task_id=None,
      environment="",
      num_accelerators=None,
      rpc_layer=None,
  ):
      """Creates a SimpleClusterResolver from a ClusterSpec."""
      super(SimpleClusterResolver, self).__init__()
  
      self._task_type = task_type
      self._task_id = task_id
      self._environment = environment
  
      self._num_accelerators = num_accelerators
      self._rpc_layer = rpc_layer
  
      if not isinstance(cluster_spec, ClusterSpec):
          raise TypeError(
              "cluster_spec must be a `tf.train.ClusterSpec`."
          )
      self._cluster_spec = cluster_spec
  
      if not isinstance(master, str):
          raise TypeError("master must be a string.")
      self._master = master
  
imports: import abc
  import collections
  import six
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  from tensorflow.python.framework import config
  from tensorflow.python.framework import ops
  from tensorflow.python.training.server_lib import ClusterSpec
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 to create a new SimpleClusterResolver object from inherited base classes: ClusterResolver with example: obj = SimpleClusterResolver(cluster_spec, master, task_type, task_id, environment, num_accelerators, rpc_layer)