2.4K Star 8.2K Fork 4.4K

GVPMindSpore / mindspore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
eye_doc.yaml 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
zlq2020 提交于 2024-03-08 10:48 . fix eye doc
eye:
description: |
Creates a tensor with ones on the diagonal and zeros in the rest.
Refer to :func:`mindspore.ops.eye` for more details.
Note:
The data type of returned tensor can be float16, float32, int8, int16, int32, int64, uint8 or bool on Ascend platforms.
Inputs:
- **n** (int) - The number of rows of returned tensor. Constant value only.
- **m** (int) - The number of columns of returned tensor. Constant value only.
- **t** (mindspore.dtype) - MindSpore's dtype, the data type of the returned tensor.
Default: ``None`` , the data type of the returned tensor is mindspore.float32.
Outputs:
Tensor, a tensor with ones on the diagonal and the rest of elements are zero. The shape of `output` depends on
the user's Inputs `n` and `m`. And the data type depends on Inputs `t`.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> import mindspore
>>> from mindspore import ops
>>> eye = ops.Eye()
>>> output = eye(2, 2, mindspore.int32)
>>> print(output)
[[1 0]
[0 1]]
>>> print(output.dtype)
Int32
>>> output = eye(1, 2, mindspore.float32)
>>> print(output)
[[1. 0.]]
>>> print(output.dtype)
Float32
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore
master

搜索帮助