• tensorflow 高级api使用分布式之配置


      """Constructor.

        Sets the properties `cluster_spec`, `is_chief`, `master` (if `None` in the
        args), `num_ps_replicas`, `task_id`, and `task_type` based on the
        `TF_CONFIG` environment variable, if the pertinent information is
        present. The `TF_CONFIG` environment variable is a JSON object with
        attributes: `cluster`, `environment`, and `task`.

        `cluster` is a JSON serialized version of `ClusterSpec`'s Python dict from
        `server_lib.py`, mapping task types (usually one of the TaskType enums) to a
        list of task addresses.

        `environment` specifies the runtime environment for the job (usually one of
        the `Environment` enums). Defaults to `LOCAL`.

        `task` has two attributes: `type` and `index`, where `type` can be any of
        the task types in `cluster`. When `TF_CONFIG` contains said information, the
        following properties are set on this class:

        * `task_type` is set to `TF_CONFIG['task']['type']`. Defaults to `None`.
        * `task_id` is set to `TF_CONFIG['task']['index']`. Defaults to 0.
        * `cluster_spec` is parsed from `TF_CONFIG['cluster']`. Defaults to {}.
        * `master` is determined by looking up `task_type` and `task_id` in the
          `cluster_spec`. Defaults to ''.
        * `num_ps_replicas` is set by counting the number of nodes listed
          in the `ps` attribute of `cluster_spec`. Defaults to 0.
        * `num_worker_replicas` is set by counting the number of nodes listed
          in the `worker` attribute of `cluster_spec`. Defaults to 0.
        * `is_chief` is deteremined based on `task_type`, `type_id`, and
          `environment`.

        Example:
        ```
          cluster = {'ps': ['host1:2222', 'host2:2222'],
                     'worker': ['host3:2222', 'host4:2222', 'host5:2222']}
          os.environ['TF_CONFIG'] = json.dumps(
              {'cluster': cluster,
               'task': {'type': 'worker', 'index': 1}})
          config = ClusterConfig()
          assert config.master == 'host4:2222'
          assert config.task_id == 1
          assert config.num_ps_replicas == 2
          assert config.num_worker_replicas == 3
          assert config.cluster_spec == server_lib.ClusterSpec(cluster)
          assert config.task_type == 'worker'
          assert not config.is_chief
        ```

        Args:
          master: TensorFlow master. Defaults to empty string for local.
          evaluation_master: The master on which to perform evaluation.
        """

  • 相关阅读:
    mysql分组排序取组内第一的数据行
    C#版Nebula客户端编译
    关于nginx
    http状态码
    gitlab
    TCP/IP 3次握手和四次断开
    nps 内网穿透
    用CentOS7做一个简单的路由器
    linux 简单特效
    LVS粗讲
  • 原文地址:https://www.cnblogs.com/YouXiangLiThon/p/7890825.html
Copyright © 2020-2023  润新知