(self,
init,
shape,
target_mean=None,
target_std=None,
target_max=None,
target_min=None)
| 36 | class InitializersTest(test.TestCase): |
| 37 | |
| 38 | def _runner(self, |
| 39 | init, |
| 40 | shape, |
| 41 | target_mean=None, |
| 42 | target_std=None, |
| 43 | target_max=None, |
| 44 | target_min=None): |
| 45 | output = self.evaluate(init(shape)) |
| 46 | self.assertEqual(output.shape, shape) |
| 47 | lim = 3e-2 |
| 48 | if target_std is not None: |
| 49 | self.assertGreater(lim, abs(output.std() - target_std)) |
| 50 | if target_mean is not None: |
| 51 | self.assertGreater(lim, abs(output.mean() - target_mean)) |
| 52 | if target_max is not None: |
| 53 | self.assertGreater(lim, abs(output.max() - target_max)) |
| 54 | if target_min is not None: |
| 55 | self.assertGreater(lim, abs(output.min() - target_min)) |
| 56 | |
| 57 | def test_uniform(self): |
| 58 | shape = (9, 6, 99) |
no test coverage detected