mindspore.ops.scalar_to_tensor ============================== .. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/resource/_static/logo_source.svg :target: https://gitee.com/mindspore/mindspore/blob/master/docs/api/api_python/ops/mindspore.ops.func_scalar_to_tensor.rst :alt: 查看源文件 .. py:function:: mindspore.ops.scalar_to_tensor(input_x, dtype=mstype.float32) 将标量转换为指定数据类型的tensor。 参数: - **input_x** (Union[bool, int, float]) - 输入标量。只能是常量值。 - **dtype** (mindspore.dtype) - 指定数据类型。只能是常量值。 返回: Tensor