def testHeNormal(self): shape = (5, 6, 4, 2) fan_in, _ = init_ops_v2._compute_fans(shape) std = np.sqrt(2. / fan_in) self._range_test(init_ops_v2.he_normal(seed=123), shape, target_mean=0., target_std=std)
def testLecunUniform(self): shape = (5, 6, 4, 2) fan_in, _ = init_ops_v2._compute_fans(shape) std = np.sqrt(1. / fan_in) self._range_test(init_ops_v2.lecun_uniform(seed=123), shape, target_mean=0., target_std=std)
def test_GlorotNormal(self): shape = (5, 6, 4, 2) fan_in, fan_out = init_ops_v2._compute_fans(shape) std = np.sqrt(2. / (fan_in + fan_out)) self._range_test(init_ops_v2.GlorotNormal(seed=123), shape, target_mean=0., target_std=std)
def testHeNormal(self): shape = (5, 6, 4, 2) fan_in, _ = init_ops_v2._compute_fans(shape) std = np.sqrt(2. / fan_in) self._range_test( init_ops_v2.he_normal(seed=123), shape, target_mean=0., target_std=std)
def testLecunUniform(self): shape = (5, 6, 4, 2) fan_in, _ = init_ops_v2._compute_fans(shape) std = np.sqrt(1. / fan_in) self._range_test( init_ops_v2.lecun_uniform(seed=123), shape, target_mean=0., target_std=std)
def test_GlorotNormal(self): shape = (5, 6, 4, 2) fan_in, fan_out = init_ops_v2._compute_fans(shape) std = np.sqrt(2. / (fan_in + fan_out)) self._range_test( init_ops_v2.GlorotNormal(seed=123), shape, target_mean=0., target_std=std)
def __call__(self, shape, dtype=tf.float32): fan_in, fan_out = _compute_fans(shape) limit = self.scale / max(1.0, float(fan_in)) return tf.random.uniform(shape, -limit, limit, seed=self.seed)