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.tril_indices

mindspore.ops.tril_indices(row, col, offset=0, *, dtype=mstype.int64)[source]

Calculates the indices of the lower triangular elements in a row * col matrix and returns them as a 2-by-N Tensor. The first row of the Tensor contains row coordinates, and the second row contains column coordinates. The coordinates are sorted by row and then by column.

The lower triangular part of the matrix consists of all elements on and below the diagonal.

Note

When running on CUDA, row * col must be less than 2^59 to prevent overflow during calculation.

Parameters
  • row (int) – number of rows in the 2-D matrix.

  • col (int) – number of columns in the 2-D matrix.

  • offset (int, optional) – diagonal offset from the main diagonal. Default: 0 .

Keyword Arguments

dtype (mindspore.dtype, optional) – The specified type of output tensor. An optional data type of mindspore.int32 and mindspore.int64. Default: mstype.int64 .

Returns

  • y (Tensor) - indices of the elements in lower triangular part of matrix. The type is specified by dtype. The shape of output is (2,tril_size), where tril_size is the number of elements in the lower triangular matrix.

Raises
Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> from mindspore import ops
>>> output = ops.tril_indices(4, 3, -1, dtype=mindspore.int64)
>>> print(output)
[[1 2 2 3 3 3]
 [0 0 1 0 1 2]]
>>> print(output.dtype)
Int64