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 integer, the data type of the output tensor is int. Otherwise, the data type of the output tensor is float.
- Parameters
input_x (tuple) – A tuple of numbers. Only constant value is allowed.
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
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]