sciai.utils.to_tuple

View Source On Gitee
sciai.utils.to_tuple(data)[source]

Convert a given param into tuple if it’s not, otherwise keep it unchanged.

Parameters

data (Union[tuple, list, any]) – A tuple or not tuple data.

Returns

Tuple, Converted tuple representation of input data.

Examples

>>> from sciai.utils import to_tuple
>>> a = 1
>>> a_tuple = to_tuple(a)
>>> print(a_tuple)
(1,)