def testFullyConnectedSeriesFBInit(self): with tf.Graph().as_default(): tf.set_random_seed(200) inputs = tf.constant([1., 2.]) outputs = tf.constant([3., 4.]) block = fb.FullyConnectedSeriesFB(lc.LayerCollection()) block.register_additional_tower([inputs], [outputs]) self.assertAllEqual([[outputs]], block.tensors_to_compute_grads())
def testInstantiateFactorsNoBias(self): with tf.Graph().as_default(): tf.set_random_seed(200) inputs = tf.constant([[1., 2.], [3., 4.]]) outputs = tf.constant([[3., 4.], [5., 6.]]) block = fb.FullyConnectedSeriesFB(lc.LayerCollection(), has_bias=False) block.register_additional_tower([inputs], [outputs]) grads = outputs**2 block.instantiate_factors((((grads, ), ), ), 0.5)