2.4K Star 8.2K Fork 4.4K

GVPMindSpore / mindspore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mindspore.Tensor.astype.rst 694 Bytes
一键复制 编辑 原始数据 按行查看 历史
GuoZhibin 提交于 2023-05-11 14:58 . astype default update

mindspore.Tensor.astype

.. py:method:: mindspore.Tensor.astype(dtype, copy=True)

    将Tensor转为指定数据类型,可指定是否返回副本。

    参数:
        - **dtype** (Union[mindspore.dtype, numpy.dtype, str]) - 指定的Tensor数据类型,可以是: `mindspore.dtype.float32` , `numpy.float32` 或 `float32` 的格式。
        - **copy** (bool, 可选) - 默认情况下,astype返回新拷贝的Tensor。如果该参数设为 ``False`` ,则返回输入Tensor而不是副本。默认值: ``True`` 。

    返回:
        Tensor,指定数据类型的Tensor。

    异常:
        - **TypeError** - 指定了无法解析的类型。
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore
master

搜索帮助