mindspore.ops.ScalarToTensor

class mindspore.ops.ScalarToTensor[source]

Converts a scalar to a Tensor, and converts the data type to the specified type.

Refer to mindspore.ops.scalar_to_tensor() for more details.

Supported Platforms:

Ascend GPU CPU

Examples

>>> op = ops.ScalarToTensor()
>>> data = 1
>>> output = op(data, mindspore.float32)
>>> print(output)
1.0