Exemplo n.º 1
0
 def test_actnorm_3d(self):
   with tf.Graph().as_default():
     x_t = tf.random_normal((16, 5, 32, 32, 3), mean=50.0, stddev=2.0)
     ops = [glow_ops.actnorm, glow_ops.get_variable_ddi]
     with arg_scope(ops, init=True):
       x_act, _ = glow_ops.actnorm_3d("actnorm", x_t)
     with tf.Session() as session:
       x_act_np = session.run(x_act)
       # Mean and standard deviation per time-step equals zero and one.
       for time_step in range(5):
         x_act_curr = x_act_np[:, time_step, :, :, :]
         channel_mean = np.mean(x_act_curr, axis=(0, 1, 2))
         channel_var = np.var(x_act_curr, axis=(0, 1, 2))
         self.assertTrue(np.allclose(channel_mean, 0.0, atol=1e-3))
         self.assertTrue(np.allclose(channel_var, 1.0, atol=1e-3))
Exemplo n.º 2
0
 def test_actnorm_3d(self):
   with tf.Graph().as_default():
     x_t = tf.random_normal((16, 5, 32, 32, 3), mean=50.0, stddev=2.0)
     ops = [glow_ops.actnorm, glow_ops.get_variable_ddi]
     with arg_scope(ops, init=True):
       x_act, _ = glow_ops.actnorm_3d("actnorm", x_t)
     with tf.Session() as session:
       x_act_np = session.run(x_act)
       # Mean and standard deviation per time-step equals zero and one.
       for time_step in range(5):
         x_act_curr = x_act_np[:, time_step, :, :, :]
         channel_mean = np.mean(x_act_curr, axis=(0, 1, 2))
         channel_var = np.var(x_act_curr, axis=(0, 1, 2))
         self.assertTrue(np.allclose(channel_mean, 0.0, atol=1e-3))
         self.assertTrue(np.allclose(channel_var, 1.0, atol=1e-3))