| 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, []) |