(export_func, output_format)
| 58 | |
| 59 | |
| 60 | def _normalize_export_func(export_func, output_format) -> tuple[Callable, str]: |
| 61 | from tvm.support import ndk, tar |
| 62 | |
| 63 | def export_with(func): |
| 64 | return lambda mod, path: mod.export_library(path, fcompile=func) |
| 65 | |
| 66 | if export_func == "tar": |
| 67 | export_func = export_with(tar.tar) |
| 68 | output_format = "tar" |
| 69 | elif export_func == "ndk": |
| 70 | export_func = export_with(ndk.create_shared) |
| 71 | output_format = "so" |
| 72 | elif callable(export_func): |
| 73 | if output_format is None: |
| 74 | raise ValueError("output_format must be specified if `export_func` is callable") |
| 75 | else: |
| 76 | raise ValueError(f"Unsupported export_func: {export_func}") |
| 77 | return export_func, output_format |
| 78 | |
| 79 | |
| 80 | def local_run( # pylint: disable=too-many-arguments,too-many-locals |
no test coverage detected
searching dependent graphs…