xref: /aosp_15_r20/external/federated-compute/fcp/artifact_building/artifact_constants.py (revision 14675a029014e728ec732f129a32e299b2da0601)
1# Copyright 2022 Google LLC
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"""Constants used throughout artifact building."""
15
16# These constants are required for legacy execution and harmless for federated
17# programs. They may be removed in the future.
18SERVER_STATE_VAR_PREFIX = 'server'
19SERVER_METRICS_VAR_PREFIX = 'metrics'
20
21# The name given to variables part of the client 'update' name space.
22UPDATE = 'update'
23
24# Indices into DistributeAggregateForm.client_to_server_aggregation parameter.
25INTERMEDIATE_STATE_INDEX = 0
26CLIENT_CHECKPOINT_INDEX = 1
27# This map is used in the construction of the aggregation portion of the Plan
28# proto to ensure that the names of the input tensor names for the aggregation
29# logic match the names of the corresponding output tensors generated by prior
30# stages of the computation.
31AGGREGATION_INTRINSIC_ARG_SELECTION_INDEX_TO_NAME_DICT = {
32    INTERMEDIATE_STATE_INDEX: 'intermediate_state',
33    CLIENT_CHECKPOINT_INDEX: 'update',
34}
35