Server push weights to clients. Namely clients pull weights from server. It is the scatter process.
(self)
| 132 | self.aggregate(weights) |
| 133 | |
| 134 | def push(self) -> None: |
| 135 | """Server push weights to clients. |
| 136 | |
| 137 | Namely clients pull weights from server. It is the scatter process. |
| 138 | """ |
| 139 | message = proto.WeightsExchange() |
| 140 | message.op_type = proto.SCATTER |
| 141 | for k, v in self.weights.items(): |
| 142 | message.weights[k] = utils.serialize_tensor(v) |
| 143 | |
| 144 | for conn in self.conns: |
| 145 | utils.send_message(conn, message) |
| 146 | |
| 147 | |
| 148 | if __name__ == "__main__": |