def testFullyConnectedMultiKFInit(self): with tf.Graph().as_default(): tf.set_random_seed(200) tensor = tf.ones((2, 3), name='a/b/c') factor = ff.FullyConnectedMultiKF(((tensor, ), ), has_bias=False) factor.instantiate_cov_variables() self.assertEqual([3, 3], factor.cov.get_shape().as_list())
def testMakeCovarianceUpdateOpNoBias(self): with tf.Graph().as_default(), self.test_session() as sess: tf.set_random_seed(200) tensor = tf.constant([[1., 2.], [3., 4.]], name='a/b/c') factor = ff.FullyConnectedMultiKF(((tensor, ), )) factor.instantiate_cov_variables() sess.run(tf.global_variables_initializer()) new_cov = sess.run(factor.make_covariance_update_op(.5)) self.assertAllClose([[3, 3.5], [3.5, 5.5]], new_cov)
def testFullyConnectedMultiKFInitFloat64(self): with tf.Graph().as_default(): dtype = dtypes.float64_ref tf.set_random_seed(200) tensor = tf.ones((2, 3), dtype=dtype, name='a/b/c') factor = ff.FullyConnectedMultiKF(((tensor, ), ), has_bias=False) factor.instantiate_cov_variables() cov = factor.cov self.assertEqual(cov.dtype, dtype) self.assertEqual([3, 3], cov.get_shape().as_list())