Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.ormqr function

PyTorch torch.ormqr function


PyTorch torch reference manual PyTorch torch reference manual

torch.ormqr is a function in PyTorch that performs matrix multiplication using a QR decomposition. It computes Q @ input or input @ Q, where Q is the orthogonal matrix obtained from the QR decomposition.

Function definition

torch.ormqr(input, tau, left=True, transpose=False, out=None)

Parameters:

Return Value:


Usage examples

Example

import

torch

Create a matrix

A

=

torch.

randn

(

3

,

3

)

B

=

torch.

randn

(

3

,

4

)

QR decomposition

Q

,

R

=

torch.

linalg

.

qr

(

A

)

Compute Q @ B

result

=

torch.

ormqr

(

B

,

torch.

zeros

(

3

)

)

print

(

"Shape of matrix B:"

,

B.

shape

)

print

(

"Result shape:"

,

result.

shape

)

The output is:

矩阵 B 形状: torch.Size([3, 4])

结果形状: torch.Size([3, 4])


PyTorch torch reference manual PyTorch torch reference manual