mindspore.ops.tuple_to_array
- mindspore.ops.tuple_to_array(input_x)[source]
Converts a tuple to a tensor.
Note
If the type of the first number in the tuple is an integer, the data type of the output tensor is int. Otherwise, the data type of the output tensor is a float.
- Parameters
input_x (tuple) – A tuple of numbers. Only constant value is allowed.
- Returns
Tensor
- Supported Platforms:
AscendGPUCPU
Examples
>>> import mindspore >>> input_x = (1, 2, 3) >>> output = mindspore.ops.tuple_to_array(input_x) >>> print(type(output)) <class 'mindspore.common.tensor.Tensor'> >>> print(output) [1 2 3]