[Cherry-pick]Det &Slogdet (#34992) #35922
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
New features
PR changes
APIs
Describe
Cherry-pick :#34992
Add new API : paddle.linalg.det & paddle.linalg.slogdet
API Alias:paddle.det& paddle.slogdet
Example:
paddle.det():
Calculates the determinant value of a square matrix or batches of square matrices.
Supports the input of float, double
Args:
x (Tensor): input (Tensor): the input matrix of size
(n, n)or the batch of matrices of size(*, n, n)where*is one or more batch dimensions.Returns:
y (Tensor): the determinant value of a square matrix or batches of square matrices.
paddle.slogdet():
Calculates the sign and natural logarithm of the absolute value of a square matrix's or batches square matrices' determinant.
The determinant can be computed with ``sign * exp(logabsdet)
Supports the input of float, double
Note that for matrices that have zero determinant, this returns
(0, -inf)Args:
x (Tensor): the batch of matrices of size : math:
(*, n, n)where math:
*is one or more batch dimensions.Returns:
y (Tensor): A tensor containing the sign of the determinant and the natural logarithm
of the absolute value of determinant, respectively.