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

17 lines
598 B
ReStructuredText
Raw Permalink Normal View History

mindspore.ops.Cast
===================
.. py:class:: mindspore.ops.Cast
转换输入Tensor的数据类型。
2022-07-22 14:07:38 +08:00
输入:
- **input_x** (Union[Tensor, Number]) - 输入要进行数据类型转换的Tensor其shape为 :math:`(x_1, x_2, ..., x_R)`
- **type** (dtype.Number) - 指定转换的数据类型。仅支持常量值。
2022-06-16 17:12:08 +08:00
2022-07-22 14:07:38 +08:00
输出:
Tensor其shape与 `input_x` 相同,即 :math:`(x_1, x_2, ..., x_R)`
2022-07-22 14:07:38 +08:00
异常:
- **TypeError** - `input_x` 既不是Tensor也不是数值型。
- **TypeError** - `type` 不是数值型。