我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用torch.geqrf()。
def test_ormqr(self): mat1 = torch.randn(10, 10) mat2 = torch.randn(10, 10) q, r = torch.qr(mat1) m, tau = torch.geqrf(mat1) res1 = torch.mm(q, mat2) res2, _ = torch.ormqr(m, tau, mat2) self.assertEqual(res1, res2) res1 = torch.mm(mat2, q) res2, _ = torch.ormqr(m, tau, mat2, False) self.assertEqual(res1, res2) res1 = torch.mm(q.t(), mat2) res2, _ = torch.ormqr(m, tau, mat2, True, True) self.assertEqual(res1, res2) res1 = torch.mm(mat2, q.t()) res2, _ = torch.ormqr(m, tau, mat2, False, True) self.assertEqual(res1, res2)