1
# -*- coding: utf-8 -*-
2 2
"""
3
@file
4
@brief Implements command line ``python -m mlprodict <command> <args>``.
5
"""
6 2
import sys
7 2
import warnings
8

9

10 2
def main(args, fLOG=print):
11
    """
12
    Implements ``python -m mlprodict <command> <args>``.
13

14
    @param      args        command line arguments
15
    @param      fLOG        logging function
16
    """
17 2
    try:
18 2
        from .cli.validate import validate_runtime
19 2
        from .cli.convert_validate import convert_validate
20 2
        from .cli.optimize import onnx_optim, onnx_stats
21 2
        from .cli.asv_bench import asv_bench
22 2
        from .cli.asv2csv import asv2csv
23 2
        from .cli.replay import benchmark_replay
24
    except ImportError:  # pragma: no cover
25
        from mlprodict.cli.validate import validate_runtime
26
        from mlprodict.cli.convert_validate import convert_validate
27
        from mlprodict.cli.optimize import onnx_optim, onnx_stats
28
        from mlprodict.cli.asv_bench import asv_bench
29
        from mlprodict.cli.asv2csv import asv2csv
30
        from mlprodict.cli.replay import benchmark_replay
31

32 2
    fcts = dict(validate_runtime=validate_runtime,
33
                convert_validate=convert_validate,
34
                onnx_optim=onnx_optim,
35
                onnx_stats=onnx_stats,
36
                asv_bench=asv_bench,
37
                asv2csv=asv2csv,
38
                benchmark_replay=benchmark_replay)
39 2
    try:
40 2
        from pyquickhelper.cli import cli_main_helper
41
    except ImportError:  # pragma: no cover
42
        warnings.warn("The command line requires module pyquickhelper.")
43
        return None
44 2
    return cli_main_helper(fcts, args=args, fLOG=fLOG)
45

46

47 2
if __name__ == "__main__":
48
    main(sys.argv[1:])  # pragma: no cover

Read our documentation on viewing source code .

Loading