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

Method test_dist_opt_spars_topk

test/python/test_dist.py:109–121  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

107 decimal=5)
108
109 def test_dist_opt_spars_topk(self):
110 # Test the C++ TopK based sparsification operation for all reduce
111
112 param.set_value(10)
113 grad.set_value(1)
114
115 sgd.sparsification(grad.data, accumulation=None, spars=1, topK=True)
116 sgd.wait()
117 sgd.update(param, grad)
118
119 np.testing.assert_array_almost_equal(tensor.to_numpy(param),
120 expected,
121 decimal=5)
122
123
124if __name__ == '__main__':

Callers

nothing calls this directly

Calls 4

set_valueMethod · 0.45
sparsificationMethod · 0.45
waitMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected