Coverage for mlprodict/onnxrt/backend_pyc.py: 0%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

5 statements  

1""" 

2@file 

3@brief ONNX Backend for @see cl OnnxInference. 

4 

5:: 

6 

7 import unittest 

8 from contextlib import redirect_stdout, redirect_stderr 

9 from io import StringIO 

10 from onnx.backend.test import BackendTest 

11 import mlprodict.onnxrt.backend_pyc as backend 

12 

13 back_test = BackendTest(backend, __name__) 

14 back_test.exclude('.*_blvc_.*') 

15 back_test.exclude('.*_densenet_.*') 

16 back_test.exclude('.*_densenet121_.*') 

17 back_test.exclude('.*_inception_.*') 

18 back_test.exclude('.*_resnet50_.*') 

19 back_test.exclude('.*_shufflenet_.*') 

20 back_test.exclude('.*_squeezenet_.*') 

21 back_test.exclude('.*_vgg19_.*') 

22 back_test.exclude('.*_zfnet512_.*') 

23 globals().update(back_test.enable_report().test_cases) 

24 buffer = StringIO() 

25 print('---------------------------------') 

26 

27 if True: 

28 with redirect_stdout(buffer): 

29 with redirect_stderr(buffer): 

30 res = unittest.main(verbosity=2, exit=False) 

31 else: 

32 res = unittest.main(verbosity=2, exit=False) 

33 

34 testsRun = res.result.testsRun 

35 errors = len(res.result.errors) 

36 skipped = len(res.result.skipped) 

37 unexpectedSuccesses = len(res.result.unexpectedSuccesses) 

38 expectedFailures = len(res.result.expectedFailures) 

39 print('---------------------------------') 

40 print("testsRun=%d errors=%d skipped=%d unexpectedSuccesses=%d " 

41 "expectedFailures=%d" % ( 

42 testsRun, errors, skipped, unexpectedSuccesses, 

43 expectedFailures)) 

44 ran = testsRun - skipped 

45 print("ratio=%f" % (1 - errors * 1.0 / ran)) 

46 print('---------------------------------') 

47 lines = buffer.getvalue().split('\\n') 

48 print("\\n".join(line for line in lines 

49 if "skipped 'no matched include pattern'" not in line)) 

50""" 

51from .backend import OnnxInferenceBackendPyC 

52 

53is_compatible = OnnxInferenceBackendPyC.is_compatible 

54prepare = OnnxInferenceBackendPyC.prepare 

55run = OnnxInferenceBackendPyC.run_model 

56supports_device = OnnxInferenceBackendPyC.supports_device