Esempio n. 1
0
 def testFullFactorInit(self):
     with tf.Graph().as_default():
         tf.set_random_seed(200)
         tensor = tf.ones((2, 3), name='a/b/c')
         factor = ff.FullFactor((tensor, ), 32)
         factor.instantiate_cov_variables()
         self.assertEqual([6, 6], factor.cov.get_shape().as_list())
Esempio n. 2
0
    def testMakeCovarianceUpdateOp(self):
        with tf.Graph().as_default(), self.test_session() as sess:
            tf.set_random_seed(200)
            tensor = tf.constant([1., 2.], name='a/b/c')
            factor = ff.FullFactor((tensor, ), 2)
            factor.instantiate_cov_variables()

            sess.run(tf.global_variables_initializer())
            new_cov = sess.run(factor.make_covariance_update_op(.5))
            self.assertAllClose([[0.75, 0.5], [0.5, 1.5]], new_cov)
Esempio n. 3
0
 def testFullFactorInitFloat64(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.FullFactor((tensor, ), 32)
         factor.instantiate_cov_variables()
         cov = factor.cov
         self.assertEqual(cov.dtype, dtype)
         self.assertEqual([6, 6], cov.get_shape().as_list())