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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
 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)
示例#7
0
 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)