mindspore.ops.ScalarToArray

class mindspore.ops.ScalarToArray(*args, **kwargs)[source]

Converts a scalar to a Tensor.

Inputs:
  • input_x (Union[int, float]) - The input is a scalar. Only constant value is allowed.

Outputs:

Tensor. 0-D Tensor and the content is the input.

Raises

TypeError – If input_x is neither int nor float.

Supported Platforms:

Ascend GPU CPU

Examples

>>> op = ops.ScalarToArray()
>>> data = 1.0
>>> output = op(data)
>>> print(output)
1.0