!28590 fix doc string

Merge pull request !28590 from zhujingxuan/code_docs_scipy
This commit is contained in:
i-robot 2022-01-06 01:20:42 +00:00 committed by Gitee
commit 0ede0a106b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 34 additions and 30 deletions

View File

@ -218,9 +218,9 @@ def cho_factor(a, lower=False, overwrite_a=False, check_finite=True):
(crashes, non-termination) if the inputs do contain infinities or NaNs. (crashes, non-termination) if the inputs do contain infinities or NaNs.
Returns: Returns:
- Tensor, Matrix whose upper or lower triangle contains the Cholesky factor of `a`. - Tensor, matrix whose upper or lower triangle contains the Cholesky factor of `a`.
Other parts of the matrix contain random data. Other parts of the matrix contain random data.
- bool, Flag indicating whether the factor is in the lower or upper triangle - bool, flag indicating whether the factor is in the lower or upper triangle
Raises: Raises:
LinAlgError: Raised if decomposition fails. LinAlgError: Raised if decomposition fails.
@ -263,7 +263,7 @@ def cholesky(a, lower=False, overwrite_a=False, check_finite=True):
(crashes, non-termination) if the inputs do contain infinities or NaNs. (crashes, non-termination) if the inputs do contain infinities or NaNs.
Returns: Returns:
Tensor, Upper- or lower-triangular Cholesky factor of `a`. Tensor, upper- or lower-triangular Cholesky factor of `a`.
Raises: Raises:
LinAlgError: if decomposition fails. LinAlgError: if decomposition fails.
@ -367,7 +367,7 @@ def eigh(a, b=None, lower=True, eigvals_only=False, overwrite_a=False,
and eigenvectors are returned. Default: None. and eigenvectors are returned. Default: None.
Returns: Returns:
- Tensor with shape :math:`(N,)`, The :math:`N (1<=N<=M)` selected eigenvalues, in ascending order, - Tensor with shape :math:`(N,)`, the :math:`N (1<=N<=M)` selected eigenvalues, in ascending order,
each repeated according to its multiplicity. each repeated according to its multiplicity.
- Tensor with shape :math:`(M, N)`, (if ``eigvals_only == False``) - Tensor with shape :math:`(M, N)`, (if ``eigvals_only == False``)
@ -465,11 +465,12 @@ def lu_factor(a, overwrite_a=False, check_finite=True):
.. math:: .. math::
A = P L U A = P L U
where P is a permutation matrix, L lower triangular with unit diagonal elements, and U upper triangular. where :math:`P` is a permutation matrix, :math:`L` lower triangular with unit diagonal elements,
and :math:`U` upper triangular.
Args: Args:
a (Tensor): square matrix of :math:`(M, M)` to decompose. a (Tensor): square matrix of :math:`(M, M)` to decompose.
overwrite_a (bool, optional): Whether to overwrite data in `A` (may increase performance). Default: False. overwrite_a (bool, optional): Whether to overwrite data in :math:`A` (may increase performance). Default: False.
check_finite (bool, optional): Whether to check that the input matrix contains only finite numbers. check_finite (bool, optional): Whether to check that the input matrix contains only finite numbers.
Disabling may give a performance gain, but may result in problems Disabling may give a performance gain, but may result in problems
(crashes, non-termination) if the inputs do contain infinities or NaNs. Default: True. (crashes, non-termination) if the inputs do contain infinities or NaNs. Default: True.
@ -518,13 +519,13 @@ def lu(a, permute_l=False, overwrite_a=False, check_finite=True):
.. math:: .. math::
A = P L U A = P L U
where P is a permutation matrix, L lower triangular with unit where :math:`P` is a permutation matrix, :math:`L` lower triangular with unit
diagonal elements, and U upper triangular. diagonal elements, and :math:`U` upper triangular.
Args: Args:
a (Tensor): a :math:`(M, N)` matrix to decompose. a (Tensor): a :math:`(M, N)` matrix to decompose.
permute_l (bool, optional): Perform the multiplication :math:`P L` (Default: do not permute). Default: False. permute_l (bool, optional): Perform the multiplication :math:`P L` (Default: do not permute). Default: False.
overwrite_a (bool, optional): Whether to overwrite data in a (may improve performance). Default: False. overwrite_a (bool, optional): Whether to overwrite data in :math:`A` (may improve performance). Default: False.
check_finite (bool, optional): Whether to check that the input matrix contains check_finite (bool, optional): Whether to check that the input matrix contains
only finite numbers. Disabling may give a performance gain, but may result only finite numbers. Disabling may give a performance gain, but may result
in problems (crashes, non-termination) if the inputs do contain infinities or NaNs. Default: True. in problems (crashes, non-termination) if the inputs do contain infinities or NaNs. Default: True.
@ -603,7 +604,7 @@ def lu_solve(lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True):
if the inputs do contain infinities or NaNs. if the inputs do contain infinities or NaNs.
Returns: Returns:
Tesnor, Solution to the system Tesnor, solution to the system
Supported Platforms: Supported Platforms:
``CPU`` ``GPU`` ``CPU`` ``GPU``

View File

@ -22,34 +22,37 @@ from ..ops import functional as F
class SolveTriangular(PrimitiveWithInfer): class SolveTriangular(PrimitiveWithInfer):
""" """
SolveTriangular op frontend implementation. Solve the equation `a x = b` for `x`, assuming a is a triangular matrix.
Args: Args:
lower (bool): The input Matrix :math:`A` is lower triangular matrix or not. A (Tensor): A triangular matrix of shape :math:`(N, N)`.
unit_diagonal (bool): If True, diagonal elements of :math:`A` are assumed to be 1 and b (Tensor): A Tensor of shape :math:`(M,)` or :math:`(M, N)`.
will not be referenced. Right-hand side matrix in :math:`A x = b`.
lower (bool, optional): Use only data contained in the lower triangle of `a`.
Default is to use upper triangle.
trans (0, 1, 2, 'N', 'T', 'C', optional): trans (0, 1, 2, 'N', 'T', 'C', optional):
Type of system to solve: Type of system to solve:
trans: system:
======== ========= 0 or 'N' a x = b
trans system 1 or 'T' a^T x = b
======== ========= 2 or 'C' a^H x = b
0 or 'N' a x = b unit_diagonal (bool, optional): If True, diagonal elements of :math:`A` are assumed to be 1 and
1 or 'T' a^T x = b will not be referenced.
2 or 'C' a^H x = b overwrite_b (bool, optional): Allow overwriting data in :math:`b` (may enhance performance)
======== ========= check_finite (bool, optional): Whether to check that the input matrices contain only finite numbers.
Disabling may give a performance gain, but may result in problems
Inputs: (crashes, non-termination) if the inputs do contain infinities or NaNs.
- **A** (Tensor) - A triangular matrix of shape :math:`(N, N)`.
- **b** (Tensor) - A Tensor of shape :math:`(M,)` or :math:`(M, N)`. Right-hand side matrix in :math:`A x = b`.
Returns: Returns:
- **x** (Tensor) - A Tensor of shape :math:`(M,)` or :math:`(M, N)`, Tensor of shape :math:`(M,)` or :math:`(M, N)`,
which is the solution to the system :math:`A x = b`. which is the solution to the system :math:`A x = b`.
Shape of :math:`x` matches :math:`b`. Shape of :math:`x` matches :math:`b`.
Raises:
LinAlgError: If :math:`A` is singular
Supported Platforms: Supported Platforms:
``GPU`` ``CPU`` ``CPU`` ``GPU``
Examples: Examples:
Solve the lower triangular system :math:`A x = b`, where: Solve the lower triangular system :math:`A x = b`, where: