mindspore2022/docs/api/api_python/ops/mindspore.ops.Eye.rst

25 lines
1013 B
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.Eye
==================
.. py:class:: mindspore.ops.Eye()
创建一个主对角线上元素为1其余元素为0的Tensor。
.. note::
结合ReverseV2算子可以得到一个反对角线为1的Tensor但是目前ReverseV2算子只支持Ascend和GPU平台。
**输入:**
- **n** (int) - 指定返回Tensor的行数。仅支持常量值。
- **m** (int) - 指定返回Tensor的列数。仅支持常量值。
- **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>`_
**输出:**
Tensor主对角线上为1其余的元素为0。它的shape由 `n``m` 指定。数据类型由 `t` 指定。
**异常:**
- **TypeError** - `m``n` 不是int。
- **ValueError** - `m``n` 小于1。