MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _range_test

Method _range_test

tensorflow/python/ops/init_ops_v2_test.py:62–79  ·  view source on GitHub ↗
(self,
                  init,
                  shape,
                  target_mean=None,
                  target_std=None,
                  target_max=None,
                  target_min=None)

Source from the content-addressed store, hash-verified

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
82class ConstantInitializersTest(InitializersTest):

Callers 14

testZerosMethod · 0.80
testOnesMethod · 0.80
testConstantIntMethod · 0.80
testRangeInitializerMethod · 0.80
testRangeInitializerMethod · 0.80
testRangeInitializerMethod · 0.80
testRangeInitializerMethod · 0.80
testRangeMethod · 0.80
testGlorotUniformMethod · 0.80
test_GlorotNormalMethod · 0.80
testLecunUniformMethod · 0.80
testHeUniformMethod · 0.80

Calls 6

absFunction · 0.70
initFunction · 0.50
evaluateMethod · 0.45
meanMethod · 0.45
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected