def test_rq(self): random_matrix = np.random.rand(10, 10) for non_negative_diagonal in [True, False]: r, q = decompositions.rq(tf, random_matrix, 1, non_negative_diagonal) self.assertAllClose(tf.tensordot(r, q, ([1], [0])), random_matrix)
def rq(self, tensor: Tensor, pivot_axis: int = -1, non_negative_diagonal: bool = False) -> Tuple[Tensor, Tensor]: return decompositions.rq(tf, tensor, pivot_axis, non_negative_diagonal)
def test_expected_shapes_rq(self): val = tf.zeros((2, 3, 4, 5)) for non_negative_diagonal in [True, False]: r, q = decompositions.rq(tf, val, 2, non_negative_diagonal) self.assertEqual(r.shape, (2, 3, 6)) self.assertEqual(q.shape, (6, 4, 5))