mindspore.ops.ScalarToArray

class mindspore.ops.ScalarToArray[源代码]

将Scalar转换为 Tensor

更多参考详见 mindspore.ops.scalar_to_array()

支持平台:

Ascend GPU CPU

样例:

>>> op = ops.ScalarToArray()
>>> input_x = 1.0
>>> print(type(input_x))
<class 'float'>
>>> output = op(input_x)
>>> print(type(output))
<class 'mindspore.common.tensor.Tensor'>
>>> print(output)
1.0