mindspore/docs/api/api_python/numpy/mindspore.numpy.diagflat.rst

19 lines
679 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.numpy.diagflat
=================================
.. py:function:: mindspore.numpy.diagflat(v, k=0)
返回一个二维数组,其数组输入作为新输出数组的对角线。
.. note::
在GPU上支持的数据类型是 ``np.float16````np.float32``
参数:
- **v** (Tensor) - 输入数据,将其平坦化并设置为输出的第 ``k`` 个对角线。
- **k** (int, 可选) - 需要的对角线;默认值: ``0`` 即主对角线, :math:`k>0` 意味着对角线高于主对角线,反之亦然。
返回:
2-D Tensor。
异常:
- **TypeError** - 如果输入不是一个Tensor。