Skip to content
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

[NNPACK] Modernize test #2868

Merged
merged 1 commit into from
Mar 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions tests/python/contrib/test_nnpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import numpy as np
import scipy.signal
from tvm.contrib import nnpack
from nose import SkipTest


def test_fully_connected_inference():
Expand All @@ -17,13 +18,11 @@ def test_fully_connected_inference():

def verify(target="llvm"):
if not tvm.module.enabled(target):
print("skip because %s is not enabled..." % target)
return
raise SkipTest("skip because %s is not enabled..." % target)
if not tvm.get_global_func("tvm.contrib.nnpack.fully_connected_inference", True):
print("skip because extern function is not available")
return
raise SkipTest("skip because extern function is not available")
if not nnpack.is_available():
return
raise SkipTest("skip because nnpack is not available")

ctx = tvm.cpu(0)
f = tvm.build(s, [A, B, D, bias], target)
Expand Down Expand Up @@ -97,13 +96,11 @@ def verify(target="llvm",
algorithm=nnpack.ConvolutionAlgorithm.AUTO,
with_bias=True):
if not tvm.module.enabled(target):
print("skip because %s is not enabled..." % target)
return
if not tvm.get_global_func("tvm.contrib.nnpack.convolution_inference", True):
print("skip because extern function is not available")
return
raise SkipTest("skip because %s is not enabled..." % target)
if not tvm.get_global_func("tvm.contrib.nnpack.fully_connected_inference", True):
raise SkipTest("skip because extern function is not available")
if not nnpack.is_available():
return
raise SkipTest("skip because nnpack is not available")

ctx = tvm.cpu(0)
output = nnpack.convolution_inference(
Expand Down Expand Up @@ -161,13 +158,11 @@ def verify(target="llvm",
algorithm=nnpack.ConvolutionAlgorithm.AUTO,
with_bias=True):
if not tvm.module.enabled(target):
print("skip because %s is not enabled..." % target)
return
if not tvm.get_global_func("tvm.contrib.nnpack.convolution_inference_without_weight_transform", True):
print("skip because extern function is not available")
return
raise SkipTest("skip because %s is not enabled..." % target)
if not tvm.get_global_func("tvm.contrib.nnpack.fully_connected_inference", True):
raise SkipTest("skip because extern function is not available")
if not nnpack.is_available():
return
raise SkipTest("skip because nnpack is not available")

ctx = tvm.cpu(0)
transformed_kernel = nnpack.convolution_inference_weight_transform(
Expand Down