[NNPACK] Add check for NNPACK being available (nnp_initialize() succeeding) (#2119)

This fixes issues with failing tests on PowerPC.
This commit is contained in:
Andrew Tulloch
2018-11-15 14:01:36 -08:00
committed by Tianqi Chen
parent 572c36d2fe
commit 69ad6aed82
3 changed files with 22 additions and 16 deletions
+4 -9
View File
@@ -5,16 +5,11 @@ from .. import api as _api
from .. import intrin as _intrin
from .._ffi.function import _init_api
def config(nthreads):
"""Configure the nnpack library.
Parameters
----------
nthreads : int
The threads number of nnpack thread pool, must be a nonnegative.
def is_available():
"""Check whether NNPACK is available, that is, `nnp_initialize()`
returns `nnp_status_success`.
"""
_Config(nthreads)
return _initialize() == 0
def fully_connected_inference(lhs, rhs, nthreads=1):
"""Create an extern op that compute fully connected of 1D tensor lhs and