mindspore/docs/api/api_python/ops/mindspore.ops.func_cast.rst

17 lines
506 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.cast
===================
.. py:function:: mindspore.ops.cast(input, dtype)
转换输入tensor的数据类型。
.. note::
将复数转换为bool类型的时候不考虑复数的虚部只要实部不为零返回 ``True`` ,否则返回 ``False``
参数:
- **input** (Union[Tensor, Number]) - 输入tensor或者数值型数据。
- **dtype** (dtype.Number) - 转换后的数据类型。仅支持常量值。
返回:
Tensor