Exemplo n.º 1
0
 def testShape(self):
     shape = [10, 5]
     gradients = tf.random_normal(shape)
     net = networks.Adam()
     state = net.initial_state_for_inputs(gradients)
     update, _ = net(gradients, state)
     self.assertEqual(update.get_shape().as_list(), shape)
Exemplo n.º 2
0
 def testNonTrainable(self):
     """Tests the network doesn't contain trainable variables."""
     shape = [10, 5]
     gradients = tf.random_normal(shape)
     net = networks.Adam()
     state = net.initial_state_for_inputs(gradients)
     net(gradients, state)
     variables = nn.get_variables_in_module(net)
     self.assertEqual(len(variables), 0)
Exemplo n.º 3
0
    def testZeroLearningRate(self):
        """Tests network produces zero updates with learning rate equal to zero."""
        shape = [10]
        gradients = tf.random_normal(shape)
        net = networks.Adam(learning_rate=0)
        state = net.initial_state_for_inputs(gradients)
        update, _ = net(gradients, state)

        with self.test_session() as sess:
            update_np = sess.run(update)
            self.assertAllEqual(update_np, np.zeros(shape))