-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Relay][Frontend] CoreML Support #2476
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# install libraries for python package on ubuntu | ||
pip2 install nose pylint numpy nose-timer cython decorator scipy tornado typing antlr4-python2-runtime attrs | ||
pip3 install nose pylint numpy nose-timer cython decorator scipy tornado typed_ast pytest mypy orderedset antlr4-python3-runtime attrs | ||
pip2 install nose pylint six numpy nose-timer cython decorator scipy tornado typing antlr4-python2-runtime attrs | ||
pip3 install nose pylint six numpy nose-timer cython decorator scipy tornado typed_ast pytest mypy orderedset antlr4-python3-runtime attrs |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,9 @@ | |
import model_zoo | ||
|
||
def get_tvm_output(symbol, x, params, target, ctx, | ||
out_shape=(1000,), input_name='image', dtype='float32'): | ||
out_shape=(1, 1000), input_name='image', dtype='float32'): | ||
shape_dict = {input_name : x.shape} | ||
with nnvm.compiler.build_config(opt_level=3): | ||
with nnvm.compiler.build_config(opt_level=2): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously this test did not run on CI. besides, it only fails on CUDA. CPU is good. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
graph, lib, params = nnvm.compiler.build(symbol, target, shape_dict, params=params) | ||
m = graph_runtime.create(graph, lib, ctx) | ||
# set inputs | ||
|
@@ -28,7 +28,7 @@ def get_tvm_output(symbol, x, params, target, ctx, | |
out = m.get_output(0, tvm.nd.empty(out_shape, dtype)) | ||
return out.asnumpy() | ||
|
||
def test_model_checkonly(model_file, model_name=''): | ||
def run_model_checkonly(model_file, model_name=''): | ||
model = cm.models.MLModel(model_file) | ||
sym, params = nnvm.frontend.from_coreml(model) | ||
x = model_zoo.get_cat_image() | ||
|
@@ -38,11 +38,11 @@ def test_model_checkonly(model_file, model_name=''): | |
|
||
def test_mobilenet_checkonly(): | ||
model_file = model_zoo.get_mobilenet() | ||
test_model_checkonly(model_file, 'mobilenet') | ||
run_model_checkonly(model_file, 'mobilenet') | ||
|
||
def test_resnet50_checkonly(): | ||
model_file = model_zoo.get_resnet50() | ||
test_model_checkonly(model_file, 'resnet50') | ||
run_model_checkonly(model_file, 'resnet50') | ||
|
||
def run_tvm_graph(graph_def, input_data, input_name, output_shape, output_dtype='float32'): | ||
""" Generic function to compile on nnvm and execute on tvm """ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure six in installed as dependency in CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added. thanks for reminding.