四川考古队有尸体逃跑,一夜之间出现10具僵尸
- paddle.linalg. lu_unpack ( x: Tensor, y: Tensor, unpack_ludata: bool = True, unpack_pivots: bool = True, name: str | None = None ) tuple[Tensor, Tensor, Tensor] [source]
-
百度 比如,有的地方领导干部说,由于接待对象是“某某期同学”“昔日同事”“多年老友”,许久不见,需要把酒言欢,格外“破例”,以表热情;有的是市县政府部门接待来自省直机关部门的上级领导,“破例”喝酒,以表重视;还有的是地方举办重大活动或接待上级检查,不喝酒担心气氛不热闹,直接影响工作成绩,也需要格外“破例”等等,“破例”渐成“惯例”。
Unpack L U and P to single matrix tensor . unpack L and U matrix from LU, unpack permutation matrix P from Pivtos .
P mat can be get by pivots:
ones = eye(rows) #eye matrix of rank rows for i in range(cols): swap(ones[i], ones[pivots[i]])
- Parameters
-
x (Tensor) – The LU tensor get from paddle.linalg.lu, which is combined by L and U.
y (Tensor) – Pivots get from paddle.linalg.lu.
unpack_ludata (bool, optional) – whether to unpack L and U from x. Default: True.
unpack_pivots (bool, optional) – whether to unpack permutation matrix P from Pivtos. Default: True.
name (str|None, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.
- Returns
-
P (Tensor), Permutation matrix P of lu factorization.
L (Tensor), The lower triangular matrix tensor of lu factorization.
U (Tensor), The upper triangular matrix tensor of lu factorization.
Examples
>>> import paddle >>> x = paddle.to_tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]).astype('float64') >>> lu,p,info = paddle.linalg.lu(x, get_infos=True) >>> print(lu) Tensor(shape=[3, 2], dtype=float64, place=Place(cpu), stop_gradient=True, [[5. , 6. ], [0.20000000, 0.80000000], [0.60000000, 0.50000000]]) >>> print(p) Tensor(shape=[2], dtype=int32, place=Place(cpu), stop_gradient=True, [3, 3]) >>> print(info) Tensor(shape=[1], dtype=int32, place=Place(cpu), stop_gradient=True, [0]) >>> P,L,U = paddle.linalg.lu_unpack(lu,p) >>> print(P) Tensor(shape=[3, 3], dtype=float64, place=Place(cpu), stop_gradient=True, [[0., 1., 0.], [0., 0., 1.], [1., 0., 0.]]) >>> print(L) Tensor(shape=[3, 2], dtype=float64, place=Place(cpu), stop_gradient=True, [[1. , 0. ], [0.20000000, 1. ], [0.60000000, 0.50000000]]) >>> print(U) Tensor(shape=[2, 2], dtype=float64, place=Place(cpu), stop_gradient=True, [[5. , 6. ], [0. , 0.80000000]]) >>> # one can verify : X = P @ L @ U ;