MCPcopy Create free account
hub / github.com/apache/singa / pull

Method pull

examples/hfl/src/server.py:118–132  ·  view source on GitHub ↗

Server pull weights from clients. Namely clients push weights to the server. It is the gather process.

(self)

Source from the content-addressed store, hash-verified

116 return self.weights
117
118 def pull(self) -> None:
119 """Server pull weights from clients.
120
121 Namely clients push weights to the server. It is the gather process.
122 """
123 # open space to collect weights from clients
124 datas = [proto.WeightsExchange() for _ in range(self.num_clients)]
125 weights = defaultdict(list)
126 # receive weights sequentially
127 for i in range(self.num_clients):
128 datas[i] = utils.receive_message(self.conns[i], datas[i])
129 for k, v in datas[i].weights.items():
130 weights[k].append(utils.deserialize_tensor(v))
131 # aggregation
132 self.aggregate(weights)
133
134 def push(self) -> None:
135 """Server push weights to clients.

Callers 1

server.pyFile · 0.45

Calls 2

aggregateMethod · 0.95
appendMethod · 0.80

Tested by

no test coverage detected