Create a runtime executor module given a coreml model and context. Parameters ---------- symbol : str The symbol that represents the Core ML model. compiled_model_path : str The path of the compiled model to be deployed. device : Device The device to depl
(symbol, compiled_model_path, device)
| 22 | |
| 23 | |
| 24 | def create(symbol, compiled_model_path, device): |
| 25 | """Create a runtime executor module given a coreml model and context. |
| 26 | |
| 27 | Parameters |
| 28 | ---------- |
| 29 | symbol : str |
| 30 | The symbol that represents the Core ML model. |
| 31 | compiled_model_path : str |
| 32 | The path of the compiled model to be deployed. |
| 33 | device : Device |
| 34 | The device to deploy the module. It can be local or remote when there |
| 35 | is only one Device. |
| 36 | Returns |
| 37 | ------- |
| 38 | coreml_runtime : CoreMLModule |
| 39 | Runtime coreml module that can be used to execute the coreml model. |
| 40 | """ |
| 41 | device_type = device.dlpack_device_type() |
| 42 | runtime_func = "tvm.coreml_runtime.create" |
| 43 | |
| 44 | if device_type >= rpc_base.RPC_SESS_MASK: |
| 45 | fcreate = device._rpc_sess.get_function(runtime_func) |
| 46 | else: |
| 47 | fcreate = tvm_ffi.get_global_func(runtime_func) |
| 48 | assert fcreate, "Cannot find `tvm.coreml_runtime.create` function." |
| 49 | |
| 50 | return CoreMLModule(fcreate(symbol, compiled_model_path)) |
| 51 | |
| 52 | |
| 53 | class CoreMLModule: |
nothing calls this directly
no test coverage detected
searching dependent graphs…