Exemplo n.º 1
0
 def test_wrong_shape(self):
     mats = [
         np.ones((2, 3, 4)),
         np.ones((3, 3))
     ]
     with self.assertRaises(tf.errors.InvalidArgumentError):
         for m in mats:
             self.sess.run(tri_to_vec(m))
Exemplo n.º 2
0
 def testTriToVec(self):
     mats = [
         np.arange(1, 4)[None, :],
         np.vstack((np.arange(1, 4), np.arange(3, 0, -1))),  # Currently, only do matrices
         np.arange(1, 16)[None, :]
     ]
     with tf.Session(''):
         for m in mats:
             # The ops are each others' inverse.
             self.assertTrue(np.all(tri_to_vec(vec_to_tri(m)).eval() == m))