xref: /aosp_15_r20/external/federated-compute/fcp/artifact_building/artifact_constants.py (revision 14675a029014e728ec732f129a32e299b2da0601)
1*14675a02SAndroid Build Coastguard Worker# Copyright 2022 Google LLC
2*14675a02SAndroid Build Coastguard Worker#
3*14675a02SAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*14675a02SAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*14675a02SAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*14675a02SAndroid Build Coastguard Worker#
7*14675a02SAndroid Build Coastguard Worker#      http://www.apache.org/licenses/LICENSE-2.0
8*14675a02SAndroid Build Coastguard Worker#
9*14675a02SAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*14675a02SAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*14675a02SAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*14675a02SAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*14675a02SAndroid Build Coastguard Worker# limitations under the License.
14*14675a02SAndroid Build Coastguard Worker"""Constants used throughout artifact building."""
15*14675a02SAndroid Build Coastguard Worker
16*14675a02SAndroid Build Coastguard Worker# These constants are required for legacy execution and harmless for federated
17*14675a02SAndroid Build Coastguard Worker# programs. They may be removed in the future.
18*14675a02SAndroid Build Coastguard WorkerSERVER_STATE_VAR_PREFIX = 'server'
19*14675a02SAndroid Build Coastguard WorkerSERVER_METRICS_VAR_PREFIX = 'metrics'
20*14675a02SAndroid Build Coastguard Worker
21*14675a02SAndroid Build Coastguard Worker# The name given to variables part of the client 'update' name space.
22*14675a02SAndroid Build Coastguard WorkerUPDATE = 'update'
23*14675a02SAndroid Build Coastguard Worker
24*14675a02SAndroid Build Coastguard Worker# Indices into DistributeAggregateForm.client_to_server_aggregation parameter.
25*14675a02SAndroid Build Coastguard WorkerINTERMEDIATE_STATE_INDEX = 0
26*14675a02SAndroid Build Coastguard WorkerCLIENT_CHECKPOINT_INDEX = 1
27*14675a02SAndroid Build Coastguard Worker# This map is used in the construction of the aggregation portion of the Plan
28*14675a02SAndroid Build Coastguard Worker# proto to ensure that the names of the input tensor names for the aggregation
29*14675a02SAndroid Build Coastguard Worker# logic match the names of the corresponding output tensors generated by prior
30*14675a02SAndroid Build Coastguard Worker# stages of the computation.
31*14675a02SAndroid Build Coastguard WorkerAGGREGATION_INTRINSIC_ARG_SELECTION_INDEX_TO_NAME_DICT = {
32*14675a02SAndroid Build Coastguard Worker    INTERMEDIATE_STATE_INDEX: 'intermediate_state',
33*14675a02SAndroid Build Coastguard Worker    CLIENT_CHECKPOINT_INDEX: 'update',
34*14675a02SAndroid Build Coastguard Worker}
35