2022-02-19 15:27:46 +08:00
|
|
|
|
mindspore.ops.EmbeddingLookup
|
|
|
|
|
|
===============================
|
|
|
|
|
|
|
|
|
|
|
|
.. py:class:: mindspore.ops.EmbeddingLookup
|
|
|
|
|
|
|
|
|
|
|
|
根据指定的索引,返回输入Tensor的切片。
|
|
|
|
|
|
|
2022-03-29 09:39:29 +08:00
|
|
|
|
此算子在 `axis = 0` 上的运行与GatherV2的功能相似,只是多一个 `offset` 输入。
|
2022-06-15 10:19:50 +08:00
|
|
|
|
|
2022-07-25 15:09:45 +08:00
|
|
|
|
输入:
|
|
|
|
|
|
- **input_params** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)` 的Tensor。是一个Tensor切片。当前,只支持二维。
|
|
|
|
|
|
- **input_indices** (Tensor) - shape为 :math:`(y_1, y_2, ..., y_S)` 的Tensor。指定输入Tensor元素的索引。当取值超出 `input_params` 在该维度的最大长度时,超出部分将返回0值。不支持负值,否则结果将未定义。其数据类型为int32或int64。
|
|
|
|
|
|
- **offset** (int) - 指定 `input_params` 切片的偏移值。实际索引等于 `input_indices` 减去 `offset` 。
|
2022-02-19 15:27:46 +08:00
|
|
|
|
|
2022-07-25 15:09:45 +08:00
|
|
|
|
输出:
|
|
|
|
|
|
Tensor,shape为 :math:`(z_1, z_2, ..., z_N)` 的Tensor。数据类型与 `input_params` 相同。
|
2022-02-19 15:27:46 +08:00
|
|
|
|
|
2022-07-25 15:09:45 +08:00
|
|
|
|
异常:
|
|
|
|
|
|
- **TypeError** - `input_indices` 的数据类型不是int。
|
|
|
|
|
|
- **ValueError** - `input_params` 的shape长度大于2。
|