(self,
init,
shape,
target_mean=None,
target_std=None,
target_max=None,
target_min=None)
| 60 | self.assertFalse(np.allclose(t1, t2, rtol=1e-15, atol=1e-15)) |
| 61 | |
| 62 | def _range_test(self, |
| 63 | init, |
| 64 | shape, |
| 65 | target_mean=None, |
| 66 | target_std=None, |
| 67 | target_max=None, |
| 68 | target_min=None): |
| 69 | output = self.evaluate(init(shape)) |
| 70 | self.assertEqual(output.shape, shape) |
| 71 | lim = 3e-2 |
| 72 | if target_std is not None: |
| 73 | self.assertGreater(lim, abs(output.std() - target_std)) |
| 74 | if target_mean is not None: |
| 75 | self.assertGreater(lim, abs(output.mean() - target_mean)) |
| 76 | if target_max is not None: |
| 77 | self.assertGreater(lim, abs(output.max() - target_max)) |
| 78 | if target_min is not None: |
| 79 | self.assertGreater(lim, abs(output.min() - target_min)) |
| 80 | |
| 81 | |
| 82 | class ConstantInitializersTest(InitializersTest): |
no test coverage detected