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

class mindspore.RowTensor(indices=None, values=None, shape=None, row_tensor=None)[source]

A sparse representation of a set of tensor slices at given indices.

When the values of a RowTensor has a shape of (d0,d1,...,dn), then this RowTensor is used to represent a subset of a larger dense tensor of shape (l0,d1,...,dn), where di is the size of i-th axis in RowTensor, l0 is the size of 0-th axis of dense tensor and it satisfies l0>d0.

The parameter indices is used to specify locations from which the RowTensor is sliced in the first dimension of the dense tensor, which means the parameters indices and values have the following relationship dense[indices[i],:,:,:,...]=values[i,:,:,:,...].

For example, if indices is [0], values is [[1, 2]], shape is (3,2) , then the dense representation of the row tensor will be:

[[1, 2],
 [0, 0],
 [0, 0]]

Warning

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

Parameters
  • indices (Tensor) – A 1-D integer Tensor of shape (d0) . Default: None.

  • values (Tensor) – A Tensor of any dtype of shape (d0,d1,...,dn) . Default: None.

  • shape (tuple(int)) – An integer tuple which contains the shape of the corresponding dense tensor. Default: None.

  • row_tensor (RowTensor) – A RowTensor object. Default: None.

Returns

RowTensor, composed of indices, values, and shape.

Examples

>>> import mindspore as ms
>>> from mindspore import Tensor, RowTensor
>>> indices = Tensor([0])
>>> values = Tensor([[1, 2]], dtype=ms.float32)
>>> shape = (3, 2)
>>> x = RowTensor(indices, values, shape)
>>> print(x.values)
[[1. 2.]]
>>> print(x.indices)
[0]
>>> print(x.dense_shape)
(3, 2)