Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.ops.LuUnpack

class mindspore.ops.LuUnpack(unpack_data=True, unpack_pivots=True)[source]

Converts LU_data and LU_pivots back into P, L and U matrices, where P is a permutation matrix, L is a lower triangular matrix, and U is an upper triangular matrix. Typically, LU_data and LU_pivots are generated from the LU decomposition of a matrix.

Warning

This is an experimental API that is subject to change or deletion.

Refer to mindspore.ops.lu_unpack() for more details.

Parameters
  • unpack_data (bool, optional) – A flag indicating if the LU_data should be unpacked. If False, then the returned L and U are None. Default: True.

  • unpack_pivots (bool, optional) – A flag indicating if the LU_pivots should be unpacked into a permutation matrix P. If False, then the returned P is None. Default: True.

Inputs:
  • LU_data (Tensor) - The packed LU factorization data. The shape of a tensor is (,M,N), where is batch dimensions, with data type int8, uint8, int16, int32, int64, float16, float32, float64. The dims of LU_data must be equal to or greater than 2.

  • LU_pivots (Tensor) - The packed LU factorization pivots. The shape of a tensor is (,min(M,N)), where is batch dimensions, with data type int8, uint8, int16, int32, int64.

Outputs:
  • pivots (Tensor) - The permutation matrix of LU factorization. The shape is (,M,M), the dtype is same as LU_data.

  • L (Tensor) - The L matrix of LU factorization. The dtype is the same as LU_data.

  • U (Tensor) - The U matrix of LU factorization. The dtype is the same as LU_data.

Supported Platforms:

GPU CPU

Examples

>>> LU_data = Tensor(np.array([[[-0.3806, -0.4872,  0.5536],
...                             [-0.1287,  0.6508, -0.2396],
...                             [ 0.2583,  0.5239,  0.6902]],
...                             [[ 0.6706, -1.1782,  0.4574],
...                             [-0.6401, -0.4779,  0.6701],
...                             [ 0.1015, -0.5363,  0.6165]]]), mstype.float32)
>>> LU_pivots = Tensor(np.array([[1, 3, 3],
...                              [2, 3, 3]]), mstype.int32)
>>> lu_unpack = ops.LuUnpack()
>>> pivots, L, U = lu_unpack(LU_data, LU_pivots)
>>> print(pivots)
[[[1. 0. 0.]
  [0. 0. 1.]
  [0. 1. 0.]]

 [[0. 0. 1.]
  [1. 0. 0.]
  [0. 1. 0.]]]
>>> print(L)
[[[ 1.      0.      0.    ]
  [-0.1287  1.      0.    ]
  [ 0.2583  0.5239  1.    ]]

 [[ 1.      0.      0.    ]
  [-0.6401  1.      0.    ]
  [ 0.1015 -0.5363  1.    ]]]
>>> print(U)
[[[-0.3806 -0.4872  0.5536]
  [ 0.      0.6508 -0.2396]
  [ 0.      0.      0.6902]]

 [[ 0.6706 -1.1782  0.4574]
  [ 0.     -0.4779  0.6701]
  [ 0.      0.      0.6165]]]