1# Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================== 15"""A configure tuple for high-level APIs for running distribution strategies.""" 16 17from __future__ import absolute_import 18from __future__ import division 19from __future__ import print_function 20 21import collections 22 23 24class DistributeConfig( 25 collections.namedtuple( 26 'DistributeConfig', 27 ['train_distribute', 'eval_distribute', 'remote_cluster'])): 28 """A config tuple for distribution strategies. 29 30 Attributes: 31 train_distribute: a `DistributionStrategy` object for training. 32 eval_distribute: an optional `DistributionStrategy` object for 33 evaluation. 34 remote_cluster: a dict, `ClusterDef` or `ClusterSpec` object specifying 35 the cluster configurations. If this is given, the `train_and_evaluate` 36 method will be running as a standalone client which connects to the 37 cluster for training. 38 """ 39 40 def __new__(cls, 41 train_distribute=None, 42 eval_distribute=None, 43 remote_cluster=None): 44 return super(DistributeConfig, cls).__new__(cls, train_distribute, 45 eval_distribute, remote_cluster) 46