From 4692440605e4d64ac5d7a9997989e106a7863651 Mon Sep 17 00:00:00 2001 From: hlu1 <14827759+hlu1@users.noreply.github.com> Date: Fri, 22 Mar 2019 18:21:06 -0700 Subject: [PATCH] [NNPACK] Modernize test (#2868) --- tests/python/contrib/test_nnpack.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/tests/python/contrib/test_nnpack.py b/tests/python/contrib/test_nnpack.py index 3ebea0e..11e23c7 100644 --- a/tests/python/contrib/test_nnpack.py +++ b/tests/python/contrib/test_nnpack.py @@ -2,6 +2,7 @@ import tvm import numpy as np import scipy.signal from tvm.contrib import nnpack +from nose import SkipTest def test_fully_connected_inference(): @@ -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) @@ -97,13 +96,11 @@ def test_convolution_inference(): 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( @@ -161,13 +158,11 @@ def test_convolution_inference_without_weight_transform(): 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( -- 2.7.4