MCPcopy Create free account
hub / github.com/BVLC/caffe / test_clear_param_diffs

Method test_clear_param_diffs

python/caffe/test/test_net.py:111–120  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

109 np.testing.assert_allclose(conv_blob.diff,manual_backward,rtol=1e-3);
110
111 def test_clear_param_diffs(self):
112 # Run a forward/backward step to have non-zero diffs
113 self.net.forward()
114 self.net.backward()
115 diff = self.net.params["conv"][0].diff
116 # Check that we have non-zero diffs
117 self.assertTrue(diff.max() > 0)
118 self.net.clear_param_diffs()
119 # Check that the diffs are now 0
120 self.assertTrue((diff == 0).all())
121
122 def test_inputs_outputs(self):
123 self.assertEqual(self.net.inputs, [])

Callers

nothing calls this directly

Calls 2

forwardMethod · 0.45
backwardMethod · 0.45

Tested by

no test coverage detected