in scripts/old_config_converter.py [0:0]
def _handle_aggregator_reducer(aggregator):
if "reducer_config" not in aggregator:
return
aggregator["reducer"] = aggregator["reducer_config"]
del aggregator["reducer_config"]
reducer = aggregator["reducer"]
if "type" not in reducer:
pass
elif "roundreducer" == reducer["type"].lower():
reducer["_base_"] = "base_reducer"
elif "dproundreducer" == reducer["type"].lower():
reducer["_base_"] = "base_dp_reducer"
elif "secureroundreducer" == reducer["type"].lower():
reducer["_base_"] = "base_secure_reducer"
elif "weighteddproundreducer" == reducer["type"].lower():
reducer["_base_"] = "base_weighted_dp_reducer"
reducer.pop("type", None)
if "fixedpoint_config" in reducer:
reducer["fixedpoint"] = reducer["fixedpoint_config"]
del reducer["fixedpoint_config"]
if (
len(reducer["fixedpoint"].keys()) != 1
or "all-layers" not in reducer["fixedpoint"].keys()
):
raise Exception(
"per-layer config for fixedpoint in secure round reducer "
"is no longer supported. Your (old) fixedpoint config should "
"have all-layers as the key for this script to work. "
"Please reach out to FL Simulator Users workplace group if "
"you need per-layer fixedpoint config support."
)
reducer["fixedpoint"] = reducer["fixedpoint"]["all-layers"]
reducer["fixedpoint"]["_base_"] = "base_fixedpoint"