MCPcopy Index your code
hub / github.com/apache/tvm / compile_coreml

Function compile_coreml

python/tvm/support/xcode.py:171–184  ·  view source on GitHub ↗

Compile coreml model and return the compiled model path.

(model, model_name="main", out_dir=".")

Source from the content-addressed store, hash-verified

169
170
171def compile_coreml(model, model_name="main", out_dir="."):
172 """Compile coreml model and return the compiled model path."""
173 mlmodel_path = os.path.join(out_dir, model_name + ".mlmodel")
174 mlmodelc_path = os.path.join(out_dir, model_name + ".mlmodelc")
175 metadata = {"inputs": list(model.input_description), "outputs": list(model.output_description)}
176 # Use the description field to send info to CoreML runtime
177 model.short_description = json.dumps(metadata)
178 model.save(mlmodel_path)
179
180 res = xcrun(["coremlcompiler", "compile", mlmodel_path, out_dir])
181 if not os.path.isdir(mlmodelc_path):
182 raise RuntimeError(f"Compile failed: {res}")
183
184 return mlmodelc_path

Callers 1

compileMethod · 0.90

Calls 3

xcrunFunction · 0.85
joinMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…