tf.keras.ops.qr
Computes the QR decomposition of a tensor.
tf.keras.ops.qr(
x, mode='reduced'
)
Args |
x
|
Input tensor of shape (..., M, N) .
|
mode
|
A string specifying the mode of the QR decomposition.
- 'reduced': Returns the reduced QR decomposition. (default)
- 'complete': Returns the complete QR decomposition.
|
Returns |
A tuple containing two tensors. The first tensor of shape (..., M, K)
is the orthogonal matrix q and the second tensor of shape
(..., K, N) is the upper triangular matrix r , where K = min(M, N) .
|
Example:
x = keras.ops.convert_to_tensor([[1., 2.], [3., 4.], [5., 6.]])
q, r = qr(x)
print(q)
array([[-0.16903079 0.897085]
[-0.5070925 0.2760267 ]
[-0.8451542 -0.34503305]], shape=(3, 2), dtype=float32)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-06-07 UTC.
[null,null,["Last updated 2024-06-07 UTC."],[],[]]