mindspore/docs/api/api_python/ops/mindspore.ops.Coalesce.rst

32 lines
2.0 KiB
ReStructuredText
Raw Normal View History

2022-11-16 10:27:59 +08:00
mindspore.ops.Coalesce
=======================
.. py:class:: mindspore.ops.Coalesce
返回输入的合并稀疏Tensor。
输入:
- **x_indices** (Tensor) - 二维Tensor表示稀疏Tensor中非零元素的索引所有元素的取值都是非负的。数据类型为int64。
2022-12-26 11:52:49 +08:00
其shape可表示为 :math:`(y, x)`
2022-11-16 10:27:59 +08:00
- **x_values** (Tensor) - 一维Tensor表示与 `y_indices` 中的索引对应的值。支持的数据类型为float16、float32。
2022-12-26 11:52:49 +08:00
其shape可表示为 :math:`(x,)`
2022-11-16 10:27:59 +08:00
- **x_shape** (Tensor) - 一维Tensor代表稀疏Tensor的shape。数据类型为int64。
2022-12-26 11:52:49 +08:00
其shape可表示为 :math:`(y,)`
2022-11-16 10:27:59 +08:00
输出:
- **y_indices** (Tensor) - 二维Tensor表示稀疏Tensor中非零元素的索引所有元素的取值都是非负的。数据类型为int64。
2022-12-26 11:52:49 +08:00
其shape可表示为 :math:`(y, z)` `z` 代表 `x_indices` 中不同索引的数量。
2022-11-16 10:27:59 +08:00
- **y_values** (Tensor) - 一维Tensor表示与 `y_indices` 中的索引对应的值。数据类型与 `x_values` 保持一致。
2022-12-26 11:52:49 +08:00
其shape可表示为 :math:`(z,)`
2022-11-16 10:27:59 +08:00
- **y_shape** (Tensor) - 一维Tensor代表稀疏Tensor的shape。数据类型为int64。
2022-12-26 11:52:49 +08:00
其shape可表示为 :math:`(y,)`
2022-11-16 10:27:59 +08:00
异常:
- **TypeError** - 输入 `x_values` 的数据类型不是float32或float16之一。
- **TypeError** - 输入 `x_indices``x_shape` 中存在数据类型不是int64的取值。
- **ValueError** - `x_values``x_shape` 不是一维Tensor。
- **ValueError** - `x_indices` 不是一个二维Tensor。
- **ValueError** - `x_indices` 第二个维度的大小和 `x_values` 第一个维度的大小不一致。
- **ValueError** - `x_indices` 第一个维度的大小和 `x_shape` 第一个维度的大小不一致。
- **ValueError** - `x_indices` 中存在负数。
- **ValueError** - `x_indices` 中存在元素取值超过了 `x_shape` 的限制。