Coverage for mlprodict/__main__.py: 100%
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
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
1# -*- coding: utf-8 -*-
2"""
3@file
4@brief Implements command line ``python -m mlprodict <command> <args>``.
5"""
6import sys
7import warnings
10def main(args, fLOG=print):
11 """
12 Implements ``python -m mlprodict <command> <args>``.
14 @param args command line arguments
15 @param fLOG logging function
16 """
17 try:
18 from .cli.validate import (
19 validate_runtime, latency, benchmark_doc)
20 from .cli.convert_validate import convert_validate
21 from .cli.optimize import onnx_optim, onnx_stats
22 from .cli.asv_bench import asv_bench
23 from .cli.asv2csv import asv2csv
24 from .cli.replay import benchmark_replay
25 from .cli.einsum import einsum_test
26 from .cli.onnx_code import onnx_code, dynamic_doc, plot_onnx
27 except ImportError: # pragma: no cover
28 from mlprodict.cli.validate import (
29 validate_runtime, latency, benchmark_doc)
30 from mlprodict.cli.convert_validate import convert_validate
31 from mlprodict.cli.optimize import onnx_optim, onnx_stats
32 from mlprodict.cli.asv_bench import asv_bench
33 from mlprodict.cli.asv2csv import asv2csv
34 from mlprodict.cli.replay import benchmark_replay
35 from mlprodict.cli.einsum import einsum_test
36 from mlprodict.cli.onnx_code import onnx_code, dynamic_doc, plot_onnx
38 fcts = dict(validate_runtime=validate_runtime,
39 convert_validate=convert_validate,
40 onnx_optim=onnx_optim,
41 onnx_stats=onnx_stats,
42 asv_bench=asv_bench,
43 asv2csv=asv2csv,
44 benchmark_replay=benchmark_replay,
45 einsum_test=einsum_test,
46 onnx_code=onnx_code,
47 latency=latency,
48 dynamic_doc=dynamic_doc,
49 plot_onnx=plot_onnx,
50 benchmark_doc=benchmark_doc)
51 try:
52 from pyquickhelper.cli import cli_main_helper
53 except ImportError: # pragma: no cover
54 warnings.warn("The command line requires module pyquickhelper.")
55 return None
56 return cli_main_helper(fcts, args=args, fLOG=fLOG)
59if __name__ == "__main__":
60 main(sys.argv[1:]) # pragma: no cover