Skip to content

Commit 0cc1daf

Browse files
committed
Fixing culprit.
1 parent 51bdd2a commit 0cc1daf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/python/frontend/coreml/test_forward.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ def get_tvm_output(func, x, params, target, ctx,
4444
return out.asnumpy()
4545

4646
def run_model_checkonly(model_file, model_name='', input_name='image'):
47-
model = cm.models.MLModel(model_file)
48-
x = model_zoo.get_cat_image()
49-
shape_dict = {input_name : x.shape}
50-
mod, params = relay.frontend.from_coreml(model, shape_dict)
47+
# Some Relay passes change operators on the fly. Ensuring that we generate new graph for each
48+
# target.
5149
for target, ctx in ctx_list():
50+
model = cm.models.MLModel(model_file)
51+
x = model_zoo.get_cat_image()
52+
shape_dict = {input_name : x.shape}
53+
mod, params = relay.frontend.from_coreml(model, shape_dict)
5254
tvm_output = get_tvm_output(mod["main"], x, params, target, ctx)
5355
print(target, ctx, model_name, 'prediction id: ', np.argmax(tvm_output.flat))
5456

0 commit comments

Comments
 (0)