Apply conversion to val. Recursively apply conversion if `val` #is a nested tuple/list structure.
(val, conversion)
| 118 | |
| 119 | |
| 120 | def conversion_helper(val, conversion): |
| 121 | """Apply conversion to val. Recursively apply conversion if `val` |
| 122 | #is a nested tuple/list structure.""" |
| 123 | if not isinstance(val, (tuple, list)): |
| 124 | return conversion(val) |
| 125 | rtn = [conversion_helper(v, conversion) for v in val] |
| 126 | if isinstance(val, tuple): |
| 127 | rtn = tuple(rtn) |
| 128 | return rtn |
| 129 | |
| 130 | |
| 131 | def fp32_to_float16(val, float16_convertor): |
no outgoing calls
no test coverage detected