async def compute_federated_sum( self, arg: FederatedResolvingStrategyValue) -> FederatedResolvingStrategyValue: py_typecheck.check_type(arg.type_signature, computation_types.FederatedType) zero, plus = await asyncio.gather( executor_utils.embed_constant( self._executor, arg.type_signature.member, 0, local_computation_factory=self._local_computation_factory), executor_utils.embed_plus_operator( self._executor, arg.type_signature.member, local_computation_factory=self._local_computation_factory)) return await self.reduce(arg.internal_representation, zero, plus.internal_representation, plus.type_signature)
async def compute_federated_sum( self, arg: FederatedComposingStrategyValue ) -> FederatedComposingStrategyValue: type_analysis.check_federated_type( arg.type_signature, placement=placement_literals.CLIENTS) id_comp, id_type = tensorflow_computation_factory.create_identity( arg.type_signature.member) zero, plus, identity = await asyncio.gather( executor_utils.embed_constant( self._executor, arg.type_signature.member, 0, local_computation_factory=self._local_computation_factory), executor_utils.embed_plus_operator( self._executor, arg.type_signature.member, local_computation_factory=self._local_computation_factory), self._executor.create_value(id_comp, id_type)) aggregate_args = await self._executor.create_struct( [arg, zero, plus, plus, identity]) return await self.compute_federated_aggregate(aggregate_args)