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

Method test_dist_opt_spars_value

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

Source from the content-addressed store, hash-verified

93 decimal=5)
94
95 def test_dist_opt_spars_value(self):
96 # Test the C++ value based sparsification operation for all reduce
97
98 param.set_value(10)
99 grad.set_value(1)
100
101 sgd.sparsification(grad.data, accumulation=None, spars=0.05, topK=False)
102 sgd.wait()
103 sgd.update(param, grad)
104
105 np.testing.assert_array_almost_equal(tensor.to_numpy(param),
106 expected,
107 decimal=5)
108
109 def test_dist_opt_spars_topk(self):
110 # Test the C++ TopK based sparsification operation for all reduce

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