def __init__(self, trans_var: AggregatorTransVar = None): if trans_var is None: trans_var = AggregatorTransVar() self._model_broadcaster = model_broadcaster.Server( trans_var=trans_var.model_broadcaster) self._model_scatter = model_scatter.Server( trans_var=trans_var.model_scatter)
def model_broadcaster_call(job_id, role, ind, *args): model_to_broadcast = args[0] if role == consts.ARBITER: return model_broadcaster.Server().send_model(model_to_broadcast) elif role == consts.HOST: return model_broadcaster.Client().get_model() else: return model_broadcaster.Client().get_model()
def __init__(self, trans_var=LegacyAggregatorTransVar()): self._guest_parties = trans_var.get_parties(roles=[consts.GUEST]) self._host_parties = trans_var.get_parties(roles=[consts.HOST]) self._client_parties = trans_var.client_parties self._loss_sync = loss_scatter.Server(trans_var.loss_scatter) self._converge_sync = has_converged.Server(trans_var.has_converged) self._model_scatter = model_scatter.Server(trans_var.model_scatter) self._model_broadcaster = model_broadcaster.Server( trans_var.model_broadcaster) self._random_padding_cipher = random_padding_cipher.Server( trans_var.random_padding_cipher)