You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.Eye.rst 1.0 kB

4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324
  1. mindspore.ops.Eye
  2. ==================
  3. .. py:class:: mindspore.ops.Eye()
  4. 创建一个主对角线上元素为1,其余元素为0的Tensor。
  5. .. note::
  6. 结合ReverseV2算子可以得到一个反对角线为1的Tensor,但是目前ReverseV2算子只支持Ascend和GPU平台。
  7. **输入:**
  8. - **n** (int) - 指定返回Tensor的行数。仅支持常量值。
  9. - **m** (int) - 指定返回Tensor的列数。仅支持常量值。
  10. - **t** (mindspore.dtype) - 指定返回Tensor的数据类型。数据类型必须是 `bool_ <https://www.mindspore.cn/docs/api/zh-CN/master/api_python/mindspore.html#mindspore.dtype>`_ 或 `number <https://www.mindspore.cn/docs/api/zh-CN/master/api_python/mindspore.html#mindspore.dtype>`_ 。
  11. **输出:**
  12. Tensor,主对角线上为1,其余的元素为0。它的shape由 `n` 和 `m` 指定。数据类型由 `t` 指定。
  13. **异常:**
  14. - **TypeError** - `m` 或 `n` 不是int。
  15. - **ValueError** - `m` 或 `n` 小于1。