Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-165

Distributed SGD Averaging

Problem

Average parameter vectors from distributed SGD workers.

Return the elementwise mean of the worker parameter lists. An empty worker list returns [].

Hint

All-reduce averages each coordinate across workers.

Test cases

case 1
in: [[[1,3],[2,4],[3,5]]]
expected: [2,4]
case 2
in: [[[1],[2]]]
expected: [1.5]
case 3
in: [[[5,5]]]
expected: [5,5]
case 4
in: [[]]
expected: []
Starter codePython
def distributed_sgd_average(worker_params):
    # Your code here
    pass

4 test cases · run your code against them in the editor